Converting URL to HTTPS via Javascript
I want to convert current url to https version with javascript. How can i done this ?
Ex: http://www.example.开发者_StackOverflow社区com --> https://www.example.com
window.location = window.location.href.replace(/^http:/, 'https:');
If you know that your http URL starts with "http://", then it is as simple as:
var httpsUrl = "https" + httpUrl.substring(4);
精彩评论