Useful Javascript Snippets

Get the current URL

var my_url = document.URL;

Get the root URL

var my_root_url = location.protocol + '//' + location.host;

Get a Hash Parameter from a URL

var my_parameter = document.URL.split('#')[1];

Redirect a page to another page

window.location.href = 'http://www.yourpageofchoice.com';