how to redirect http to https using javascript

<script>
if (location.protocol != ‘https:’)
{
location.href = ‘https:’ + window.location.href.substring(window.location.protocol.length);
}
</script>

Leave a Comment