MENU
Using Location
RESETRUNFULL
<!DOCTYPE html><html><head></head><body id="body">
<script>
location.hash = "#body"; // jumpts to anchor
location.search = "?q=123"; // queries server
function p(s){
document.write(s+"<br/>");
}
p("href: "+location.href);
p("protocol: "+location.protocol);
p("host: "+location.host);
p("hostname: "+location.hostname);
p("port: "+location.port);
p("pathname: "+location.pathname);
p("search: "+location.search);
p("hash: "+location.hash);
p("origin: "+location.origin);
p("toString: "+location.toString()); // Redirection // 1. location = "//google.com"; // 2. location.assign("//google.com"); // 3. location.replace("//google.com"); // ...3. not saved in history // Reload // location.reload(true);
</script></body></html>