Thursday, November 14, 2019

How To Detect HTTP Or HTTPS in JavaScript?


console.log(location.protocol);
//output => https:

You can change the protocol of the site simply by using following logic:
var protocol = location.protocol === 'https:' ? 'http' : 'https';

console.log(protocol);
//output => http

No comments:

Post a Comment

Yoast SEO — Simple Guide

  7 Yoast SEO is one of the most popular WordPress plugins used to optimize your website for search engines (Google) without needing deep ...