I'm trying to get a child JavaScript application to update it's parent document.
In essence, this is a very simple problem:
- a JavaScript program opens an iframe in it's own document.
- another JavaScript program is loaded into the iframe.
- the second program needs to change the fragment (anchor) in the original page.
- the first program, then "goes" to the new fragment (the document position is updated, but the document is not refreshed).
In an endless number of web pages there are descriptions of how to do this, using tricks like:
window.parent.location.hash = "#" + string
But when I do this in IE, the parent appears to be refreshing itself. I think the page is reloading.
Just to make this a bit trickier:
- I need solutions for all browsers (or at very least IE and Firefox).
- Both JavaScript programs are actually GWT web apps (so I can tie specific code to different browser versions).
- If necessary I can do weird things to get around security, the parent and child will always be known to each other. The child is always called by the parent.
I've tried a bunch of other tricks listed on various web pages, but so far nothing seems stable and simple enough to actually be deployed.