Using JavaScript to change the URL used when a page is bookmarked...

Posted by user30997 on Stack Overflow See other posts from Stack Overflow or by user30997
Published on 2009-04-01T17:18:33Z Indexed on 2010/03/12 9:57 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

JavaScript doesn't allow you to update window.location without triggering a reload. While I agree with this policy in principle (it shouldn't be possible to visit my website and have JavaScript change the location bar to read www.yourbankingsite.com,) I believe that it should be possible to change www.foo.org/index to www.foo.org/help.

The only reason I care about this is for bookmarking. I'm working on a photo browser, and when a user is previewing a particular image, I want that image to be the default if they should bookmark that page. For example, if they are viewing foo.org/preview/images0-30 and they click on image #15, that image is expanded to a medium-sized view. If they then bookmark the page, I want the bookmark URL to be foo.org/preview/images0-30/active15.

Any thoughts, or is there a security barrier on this one as well? I can certainly understand the same policy being applied here, but one can dream.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about bookmarks