Forum Moderators: open

Message Too Old, No Replies

Dropping frame

removing navigation frame

         

m_leefs

4:21 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



I have a site that opens another site in a bottom frame, with my navigation bar in the top frame. I want to include a button or link in the navigation frame that allows the viewer to close/remove the top navigation frame if they do not want to use it.
Is there a way to do that?

thanks.

DrDoc

4:23 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<a href="javascript:top.location.href=otherframe.location.href">Close me</a>

Alternative Future

4:24 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you mean something like this:

<a href="http://www.yourLinkedSite.com" target="_top">Break out of Frames</a>

That closes down the frame and displays the bottom site/content.

-George

j4mes

4:30 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



Or, if you're feeling really adventurous, you could try a dhtml static menu from somewhere javascriptkit or similar :)

m_leefs

5:01 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



The problem is that the viewer may want to close the navigation bar after linking through several pages. So I don't know what site to link to.

DrDoc

8:06 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So, use the example I posted above... It does exactly what you want it to do. All you have to do is replace "otherframe" with the name of the actual other frame...

m_leefs

8:42 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



Sorry, I'm not explaining myself well. Let me show some of the code and try to explain myself better.

<frameset rows="91,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="../top_frame.php" name="topFrame" scrolling="auto" >
<?
$searchFor = $_GET["searchFor"];
print <<<END
<frame src="http://www.someothersite/search.php?term=$searchFor" name="mainFrame">
END;
?>
</frameset>
<noframes><body>
</body></noframes>

The topFrame is from my site, and the mainFrame is someone elses site. If someone goes to this site they might go through several links in the main frame and then decide to close the top frame. Therefore I would not know the URL of the main frame. Am I confused about this? If so, what do I put in the following javascript code:

<a href="javascript:top.location.href=otherframe.location.href">Close me</a>

DrDoc

9:01 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<a href="javascript:top.location.href=mainFrame.location.href">Close me</a>

m_leefs

10:16 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



I'm sorry, but I'm not real familar with JS. I put

<a href="javascript:top.location.href=mainFrame.location.href">Close me</a>

into the top frame navigation bar, but when I clicked on it nothing happened. Could it be due to the PHP code?

(thanks by the way for spending all this time on a newbie).

DrDoc

2:34 pm on Apr 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Then try:
<a href="javascript:top.location.href=parent.mainFrame.location.href">Close me</a>

m_leefs

7:23 pm on Apr 15, 2004 (gmt 0)

10+ Year Member



Sorry, it is still not working. Does one need to have the java script inside of a <script> tag? When I have the mouse over the link, the status bar has the following:

javascript:top.location.href=parent.mainFrame.location.href

Shouldn't this be replaced with the link to the mainFrame? Is there a page out there that I can see how it works?

DrDoc

7:35 pm on Apr 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is the page in the mainFrame on the same domain?

m_leefs

9:24 pm on Apr 15, 2004 (gmt 0)

10+ Year Member



No, the top frame and frame set is on my domain (www.mysite.com) and the main frame is from another site (www.someothersite.com/section1/page3/etc.html). From the question I assume this matters. Sorry I didn't make that clear. What should I do different then?

DrDoc

12:13 am on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, if they are on different domains, then it simply can't be done... which is why the code didn't work when you tried it.
JavaScript does not have access across domains...

mifi601

12:55 am on Apr 16, 2004 (gmt 0)

10+ Year Member



i guess you could cloak the main frame and just close the top one, in effect leaving an empty (maybe your title tags ..) frame around the other domain. it would look like what you want.

m_leefs

1:09 am on Apr 16, 2004 (gmt 0)

10+ Year Member



Thanks everyone for your help.

Where can I look for more info on cloaking the main frame?

mifi601

2:31 am on Apr 16, 2004 (gmt 0)

10+ Year Member



create a frameset with two frames. one 100% the other 0% link into the 100% and off you go;

<FRAMESET cols="100%,*" border=0 frameborder=0 framespacing=0>
<FRAME name="left" src="http://YOUR OUTSIDE DOMAIN HERE" frameborder=0 marginheight=0 marginwidth=0></FRAME>
<FRAME name="right" frameborder=0 marginheight=0 marginwidth=0></FRAME>
</FRAMESET>

x51k

6:19 pm on May 17, 2004 (gmt 0)



greetings came someone tell me:

When using the

javascript:top.location.href= .......

type of coding, what word would I use in this if I wanted the page I was loading to LOAD INTO A BLANK or NEW window?

I have tried using

javascript:new.location.href= ......

AND

javascript:blank.location.href= .....

But those do not work.

Bonusbana

7:00 pm on May 17, 2004 (gmt 0)

10+ Year Member



In your top_frame.php put:

<?
$searchFor = $_GET["searchFor"];
?>
<a href="http://www.someothersite/search.php?term=<? print $searchfor;?>" target="_parent">close me</a>

This will open the same page in your parent frame, which should be the whole window. This will make it look like the top frame was "closed".