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

1 hour Free Service for WordPress website :)

      1 hour Free Service for WordPress website :)