كيف أنفد هذه الشروط بالجيكوري او جافاسكريبت ؟

السلام عليكم

من فضلكم اريد كود جيكوري بقوم بما يلي

if myurl = https  ; and browser url = http  >> rederct browser to https
if myurl = http ; and browser url = https >> rederct browser to http

Ammar_Alsory أضف ردا

var myurl ="https :// io..hsoub..com";

if( (myurl.substring(0,5)=="https") && (location.protocol == "http :") ){

//redirect to https as @ Khaled Html 's example

}else if( (myurl.substring(0,4)=="http") && (location.protocol == "https :") ){

//redirect to http

}

احسنت العمل، شكرا لك