If I use relative paths in Javascript to get the page from the server (to output the output inside the div), does Javascript use the same protocol / port as the page on which it was loaded?
For instance:
the parent page is requested https://www.foo.com/bar.php
JS code on bar.php:
var turl = "/new_dir/index.php?r="+r; if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET",turl,false); xmlhttp.send(null);
Since the parent page was requested and served using https on port 443, does this mean that JS will send a GET request to a new page using the same protocol and port? Or will he send the request via http to port 80, since I did not specify the connection protocol in the turl variable?
source share