homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Right click, wrong content.
Open in new window takes user to index.html

 4:06 am on Apr 28, 2006 (gmt 0)

I hope someone can help me, I just registered and searched this forum for an hour looking for the answer to my question so that I wouldnt have to bother you all with a post but have had no luck in finding what i am looking for.

I have a website designed with the menu links pointing to an iframe. The links are images and if a user right clicks the link to open in a new window, it only opens the content of the iframe. I am wondering if there is a code that when a user right clicks and opens in a new window, the actual index.html opens instead of the iframe content page.

a href="links.html" target="main"
If the user clicks that it opens like it should in the main iframe window
if they right click it and open in new window, it opens links.html which is the content to appear in the main frame and i dont want users to be able to open that page by itself, i'd rather the window open the index.html

I hate to be a bother but,is there a simple solution to this?



 4:23 am on Apr 28, 2006 (gmt 0)

Hi Lola,

You need to add a javascript to the target page which checks if it correctly enclosed in frames, and if not, reloads the page correctly with the frames.


 10:26 am on Apr 28, 2006 (gmt 0)

Try searching WebmasterWorld for frame buster [google.com].

edit: sorry, friday brain not working, that's for breaking a page out of frames altogether..


 3:37 pm on Apr 28, 2006 (gmt 0)

Here's the script you may have been thinking of:

Force Many Pages Into Frames [webmasterworld.com] - Message #21


 6:31 pm on Apr 28, 2006 (gmt 0)

I tried it, but it's not exactly what i am looking for. I probably should have worded my question a little different.

What I need is for when a user right clicks on a link to open in a new window, I need that new window to open as the index.html rather than the page for the link that they are right clicking on. I'm sorry, I hope that didnt confuse you.


 7:03 pm on Apr 28, 2006 (gmt 0)

The script would still accomplish that - any time the "should-be-framed" page is requested on its own, orphaned from the frameset, this approach will load it inside the frameset. This is true whether it's in a new window, or direct search engine traffic, or a direct type-in. It won't just open the default index state, it will open with that particular page loaded in the correct frame.


 7:19 pm on Apr 28, 2006 (gmt 0)

I understand that, but the whole site itself is one image that was cut around the iframe, it's complicated, if i use that script, i lose the design in the new window.


 7:28 pm on Apr 28, 2006 (gmt 0)

You should not lose any design if you set up the master.html page as it says there -- it will carry all the same information, same images, etc, as index.html does.

If you just want to load the index.html page (but this would be a disservice to user, imo) then you could use a much simplified javascript -- just this:

if (top.location == self.location)


 8:12 pm on Apr 28, 2006 (gmt 0)

I got it to work properly once i changed the frameset to 100%
Thanks for the help, sorry for the blonde moment.


 8:49 pm on Apr 28, 2006 (gmt 0)

Glad you got it to work. I have them too, but I call them senior moments!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved