View Full Version : ALERT if not in frames...two options

07-07-2003, 06:06 AM
Because I don't "know" JavaScript, I need someone to direct me to or write me a specific script.

I need an ALERT to put on web pages within a framed web site. I do not want to break frames automatically -- I want to give the user the option. So, with the alert I need to give them a YES and a NO button. YES would open the web site in frames, and NO would allow them to remain on the exact non-framed page that they're already on.

Any help?

07-07-2003, 09:29 AM
hm... why javascript? To detect what? Just make a simple intro, in pure HTML, and give there the user a chance to follow framed or noframed versions...

07-08-2003, 01:53 AM
Let me be more specific. My web site is framed -- no options about it. Some of my sub-pages are coming up in search engines. When a user then follows said link, they're given my sub-page out of it's frame. I do not, however, want to force frames. I want to give them the option to go to the main framed site via a JS alert. Does that help?

07-08-2003, 09:08 AM
hm... that sounds familiar... some time ago I've put a related question here... I wondered if there is any possibility to force parent frame if children frames are loaded when found alone by search engine.

Anyway, the general answer was that there is no client-side possibility to do that, so I don't think that your problem can be solved in this manner... but, yet, who knows...

Roy Sinclair
07-08-2003, 04:09 PM
Actually it would only take a simple modification of the "force frames" script to do this.

if (top.location.href == location.href)
if (confirm("Show this page within it's proper frames?")) location.href = "place url for your frame here";

07-09-2003, 05:52 AM
Thanks (again) Roy. All it takes is a little JS coding knowledge. I'm glad you have it...since I don't. Your code works perfectly.