Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function checkcode(url){
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, false);
- try{xhr.send();return xhr.status()}
- catch{return null;}
- function gproto(url){
- if (checkcode("https://"+a) == 200)){window.location.href = "https://"+a;}
- else if (checkcode("http://"+a == 200)){window.location.href = "http://"+a;}
- else {window.location.href = "https://"+a;}//Могут быть иной возврат, 400, 403, возвращаем стандартный протокол
- function Reloc(a)
- {
- if (a.substr(0,6) != "http://" || a.substr(0,6) != "https://"){gproto(a);}
- else {window.location.href = a;}
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement