Javascript redirect to SSL


/ Published in: JavaScript
Save to your folder(s)

Redirect to SSL script


Copy this code and paste it in your HTML
  1. function redirectSecure()
  2. {
  3. if (document.location.protocol != “https:”){
  4. var oldURL = window.location.hostname + window.location.pathname+window.location.search;
  5. var newURL = “https://” + oldURL;
  6. window.location = newURL;
  7. }
  8. }
  9. redirectSecure();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.