Link to home
Start Free TrialLog in
Avatar of Nagas062301
Nagas062301

asked on

Popups but only if they leave the domain

I know, I know Popups are evil I totally agree BUT  you know marketroid they just dont seem to get it.

Heres my problem.

I can popup a popup if they close a browser. (works great)

My big problem is this. The marketdroid wants a popup when they leave the site not going to another page insode the site. For example.

If I am browsing www.whatever.com I dont want a popup to popup.

BUT if I close the browser OR leave the site popup comes up. So if im on www.whatever.com/index.html and I go to www.whatever.com/page2.html no popup .

BUT if I click on a favorite/outside link I do want a popup.

How can this be done?
Another thing. I cannot change any of the links.
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nagas062301
Nagas062301

ASKER

Good solution but I want to avaiod frames at all costs. Any other suggestions?
Nagas
I can't see away of doing this.

external links are easy

<a href=# window.location.href="external.htm; popup()">The link</a>

refresh is easy as a refresh can be detected although I can not find the code at the moment

The back/forward buttons are temptingly close in that you can detect the domain of the url ahead and behind but by window.history[-1].url window.history[1].url if both are in/out of your domain then all is fine but if they are different (ie.one in one out) you have problems as you cannot detect if the user is going back or forward.

I think frames are your only answer. It is not too bad as only the home page goes in the frames the rest is taken care of.



Thanks, GwynforWeb :-)