[thelist] Tricky, tricky problem. capture link location in aniframeof a modal w

James Aylard evolt at pixelwright.com
Fri Dec 19 15:26:11 CST 2003


Scott Blanchard wrote:

> Do you have any ideas for Netscape/Mozilla? Is there some way to
> determine when the location.href has changed? My app is cross
> platform.

    Offhand, I don't have an answer for you on that. I am not aware of a
Mozilla-friendly event for determining when a location.href change has taken
place in an iframe. Perhaps someone else will.

> Also, I haven't addressed the issue of pop-up windows. Any
> suggestions on keeping those within the iframe as well? Not really
> sure how I want to deal with those to be honest. I'm open to
> suggestions there as well.

    I'm not clear on what you mean by pop-up windows here. Do you mean
incidental pop-ups that result from outside pages opened within the child
iframe? No, I can't see of a way to do anything about those. If you mean, is
there a way for you to keep windows or alerts that you pop from within the
modeless dialog to stay within its confines, you can control new windows
somewhat by designating top and left values; alerts and so forth are
controlled by the browser. Otherwise, you can create pseudo pop-up windows
within your iframe by displaying hidden divs that are fashioned to look like
dialog boxes. But again, I'm not quite clear on what you are asking.

> One more question. When you say...
>
> "You can then successfully target a child iframe
> within that parent iframe."
>
> How exactly could I do that owing to the fact that I do not have
> ownership of the pages that appear in the iframe. These could be any
> web page in existence, if you will. Can I set a global target
> location for all links that are clicked on in that window? Perhaps
> via some overide of the actual page?

    If a document is contained within that iframe, any link within that
document that is clicked will open the target document within that same
iframe, unless that link has a different target specified, which is out of
your control. It will work the same way that a standard frame does.

> Also, some location changes will be as a result of a button click or
> a form change, so there will be no click on an href per say, I need
> some way to account for all location redirects to that they all open
> in my iframe.

    Again, I'm not quite clear on what you're describing. You can change the
location.href of that inner iframe through a link or a script or whatever.
Of course, you can't extract that location.href information back out due to
security restrictions (assuming that the iframed document is outside of the
current domain), so if your users navigate away from the url originally
typed into a text input, you can know that the iframe's content has changed
(using onreadystatechange), but you can't determine what the new
location.href is.
    Unfortunately, the browser is a limited tool when used as a
web-application platform, and I think you may be bumping into some of those
limitations.

James Aylard



More information about the thelist mailing list