If by:
Which brings to the point of my post - if I used this code . . .
you mean the DHTML Window Widget code, you don't have to. But you can't change the address of the parent of a Widget without losing the Widget as the Widget isn't a separate window. It's either content on the parent page (specified inline or in a separate div on the page) or content imported to the parent page via iframe or AJAX. In all four cases, if the address of the parent page changes, the Widget disappears and is gone.
That said, you can access the parent page in all but the iframe method Widget simply by using ordinary javascript, the widget contents are on the parent page. In the case of the iframe method, the page in the Widget is separate and may access the parent page via parent. So from the page in the iframe you could do:
Code:
<a href="somepage.htm" target="_parent">Some Page</a>
But clicking on it will change the parent and the iframe holding the Widget page was on the old parent, so it goes away.
You can also do other things from the iframe, like:
Code:
<a href="#" onclick="parent.document.getElementById('info').innerHTML = 'Hello from the iframe'; return false;">Say hello on the parent</a>
Then if there's an element on the parent with the id 'info', the message will appear in it.
You could even fetch complex content to the parent via AJAX, and as long as the iframe holding the Widget page wasn't overwritten, it would remain.
The coding at that point could get complex unless you used a script library like jQuery to simplify things (recommended if you go this route). But the advantage is that (if done right, and of course if the user has javascript enabled) no modern browser would block or misinterpret what you intended the client to see.
Bookmarks