Last active
March 29, 2017 13:38
-
-
Save bdogan/f9dc4e98b9a9230bd156552cd899b943 to your computer and use it in GitHub Desktop.
Platinmarket https redirection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.location.protocol == 'http:') { | |
function hasValidCertificate(cb) { | |
var img = new Image(); | |
img.onload = () => cb(true); | |
img.onerror = () => cb(false); | |
img.src = `https://${window.location.host}${window.location.port == 80 ? '' : window.location.port}/img/logo.jpg`; | |
} | |
hasValidCertificate(result => result === true ? window.location = window.location.toString().replace('http:', 'https:') : () => {}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment