SyntaxFix
Write A Post
Hire A Developer
Questions
Functional way
window.location.protocol === 'http:' && (location.href = location.href.replace(/^http:/, 'https:'));