Skip to content

Instantly share code, notes, and snippets.

@kkoziarski
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkoziarski/1eede7b9f6dd0c1bdb4d to your computer and use it in GitHub Desktop.
Save kkoziarski/1eede7b9f6dd0c1bdb4d to your computer and use it in GitHub Desktop.
Redirect to HTTPS bookmarklet
//#JS #bookmarkelt
//redirect to https
(function() {
var url = window.location.href.toLowerCase();
if(url.indexOf('https:') < 0 && url.indexOf('http:') >= 0) {
var httpsUrl = 'https:' + window.location.href.substring(5); //url.replace('http', 'https');
window.location.href = httpsUrl;
}
})()
javascript:(function(){var url=window.location.href.toLowerCase();if(url.indexOf('https:')<0&&url.indexOf('http:')>=0){var httpsUrl='https:'+window.location.href.substring(5);window.location.href=httpsUrl;}})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment