Get some information about the host.
bower install host.js
Host.js exposes an object called $host that contains some methods. You can see the methods available through the options method.
Assuming that we are in www.example.com
without parameter it get the URL
$host.url();
/* http://example.com */
with parameter it navigates to another address
$host.url("http://foo.com");
or
$host.url("/foo");
Get the protocol being used
$host.protocol();
or set the protocol
$host.protocol("https");
Get the parameters passed
$host.params();
/* http://example.com?foo=foo&bar='bar' */
Will return a object like this:
{ foo: 'foo', bar: 'bar' }
or set the params
$host.params({ name: 'John' });
/* http://example.com?name=John */
Reload the page
$host.reload();
Get the URL hash
$host.hash();
/* http://example.com#foo*/
Will return a string like this:
"#foo"
or set the hash
$host.hash("#bar");
/* http://example.com#bar*/
Shows the options
$host.options();
Will return something like this
url() protocol() hash() addHash() params() reloadPage() options()