Some thoughts (none tested):
In your code below, doesn't it do a refresh the way
that you have it? If so, couldn't you rather cancel the
event to avoid the refresh?
Also, since you are setting document.location.href to
something, my thought is what is that value that is
then in there? Is it already the hopeful new document's
href? If so, and if the number of trusted sites is
"reasonably finite" (after all, to trust a site you should
know it, right?) then you could cancel the event or
use your technique if the purported destination is
one of the trusted domains
Lotta ifs...
Good luck,
Csaba Gabor
"Robert Oschler" <no_replies@fake_email_address.invalid> wrote in message
news:ltG2b.18548$2Y6.5657574@news2.news.adelphia.n et...[color=blue]
> "Fred Basset" <fred.basset@whosyourdaddy.com> wrote in message
> news:3f4b167a$1$62079$75868355@news.frii.net...[color=green]
> > I'm sorry that I can't be more helpful, but all I can be pretty certain
> > of is that you can't prevent the unloading of a page. Imagine the hassle
> > that annoying ad-pages could cause if they could prevent the unload of
> > the page whenever they wanted ... unfortunately you may need another
> > solution?
> >
> > Fred Basset
> >
fred.basset@whosyourdaddy.com
> >
> > *** Sent via Developersdex
http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it![/color]
>
> Fred,
>
> Perhaps I misunderstand you but I've been very successful preventing the
> unload of a page with:
>
> // Between head tags.
> <SCRIPT>
> var gCurrentURL = document.location.href;
> </SCRIPT>
>
> // Function called by BODY onunload() event.
> function onBodyUnload()
> {
> // This prevents the URL change by resetting the document
> // document.location.href property to the current URL.
> // This is where I would put the logic, if I knew how, to prevent the
> URL
> // change if an "untrusted" IFrame tried to change the top level URL.
> document.location.href = gCurrentURL;
> }
>
> thx
> --
>
> Robert Oschler
> "Let the web hear you, add your voice to your web site in minutes!"
> --
http://audiodirect.spiderchase.com/
> (For a limited time, free voiceover with every sign-up, use this link
> instead)
> --
http://audio.spiderchase.com/
> (A song - are you blue?)
> --
http://bluedreams.spiderchase.com/
>
>[/color]