part of a js have error when my webstie change to “https” from “http”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



part of a js have error when my webstie change to “https” from “http”



There is a js in my website to switch desktop version to mobile version when using smartphone.
But when the website change from "http" to "https", it doesn't work.


var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windowssce|palm/i.test(navigator.userAgent.toLowerCase()));
var userLang = (navigator.language) ? navigator.language : navigator.userLanguage;

var path = document.location.toString();
var domain = path.replace("http://", "");
domain = "http://" + domain.substr(0, domain.indexOf("/"));
if (path.indexOf("city-gallery") != -1) domain = "/city-gallery";

var path_a = path.substr(0, path.indexOf(domain) + domain.length + 1);
var path_b = "mobile/";
var path_c = path.substr(path.indexOf(domain) + domain.length + 1);

if (mobile)
if (path.indexOf("/mobile/") == -1)
if (document.referrer.indexOf(domain) == -1)
path = path_a + path_b + path_c;
document.location = path;





});



How can I change it to make it work??









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard