Skip to content

Instantly share code, notes, and snippets.

@bdogan
Last active March 29, 2017 13:38
Show Gist options
  • Save bdogan/f9dc4e98b9a9230bd156552cd899b943 to your computer and use it in GitHub Desktop.
Save bdogan/f9dc4e98b9a9230bd156552cd899b943 to your computer and use it in GitHub Desktop.
Platinmarket https redirection
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