UPDATES VIA   RSS  |  Email Get updates via feedburner Get updates via twitter
Home

Archive for June 10th, 2009

JavaScript: Get anchor from URL

Posted on 10. Jun, 2009 by .

2

To get the anchor from an URL (this is the text after the # character) in JavaScript you can use the following code: var url=’http://iwebdevel.com/some-post#comment-1′; //if you need to take the current url of the window use: var url=window.location; var anchor=url.hash; //anchor with the # character var anchor2=url.hash.substring(1); //anchor without the # character If you’re [...]

Continue Reading