Welcome to WebmasterWorld Guest from 54.166.117.130

Forum Moderators: incrediBILL

Right click, wrong content.

Open in new window takes user to index.html

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

5+ Year Member



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.

Example:
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)

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



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)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

5+ Year Member



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)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

5+ Year Member



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)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)
top.location.href="index.html"
8:12 pm on Apr 28, 2006 (gmt 0)

5+ Year Member



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)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month