views:

17

answers:

1

I have a flash document viewer embedded in my page, where the user can view the preview version of the document, and then purchase the full version if they like. Is it possible to have a hyperlink in the document itself "BUY NOW" which would command the browser to do something on the current page without having to refresh?

I'm imagining something like:

www.example.com/currentpage.php#buy

...as a link in the embedded document, which would in theory scroll to a position in the parent webpage. Are there any mechanisms, maybe event handlers where I can run some js upon being directed to the "#buy" anchor?


EDIT: I just discovered javascript has a

window.location.hash

object that I can check, but I don't want to poll for it, the question remains if there are any mechanisms or events to detect it changing?

+1  A: 

You have the onhashchange event

https://developer.mozilla.org/en/dom/window.onhashchange

Rajat