Reputation: 18995
For example, if you enter https://translate.google.com/#en/la/werwer in browser address bar, it will open https://translate.google.com and fills "translate from" field with "werwer". How is it done?
Upvotes: 1
Views: 87
Reputation: 59232
Its done with location object. You can do it too.
Like this:
window.location.hash="werwer";
And you can parse it using the same.
var hash = window.location.hash; // contains #en/la/werwer
Upvotes: 3
Reputation: 6698
JavaScript has access to the page's URL, which contains the "werwer". Pages like that use JavaScript to parse the hash part of the URL to set up the page state when it loads.
Upvotes: 0