Safari and opening target links in frames

Discussion in 'Web Design and Development' started by branana, Mar 30, 2006.

  1. branana macrumors member

    Jan 15, 2006
    I'm having a problem with my Safari. It doesn't seem to recognize frames with their names properly.

    So, say there is a frame called bob,
    and a link:

    <a href="newpage.htm" target="bob">click</a>
    When link is clicked, newpage.htm would always open in a new safari window. This is not just for a site I made. The pages in question include various scripts, phpmyadmin etc, all of which has this target frames opening in new window issue. I am running the latest versions of OSX/Safari on 2 machines, a PPC one and a x86 one, same problem.

    The developement machine is running Apache 2, php 5.12.

    The problem happens in Webkit browsers: tested: Safari, Shiira
    The problem does NOT occur in Gecko: Firefox, Camino
    It does NOT occur in Opera either.

    Any help is appreciated, I couldn't find much information on it on Google. It's a bit WTF :(
  2. floyde macrumors 6502a


    Apr 7, 2005
    Monterrey, México
    Ok, here is a frameset that works in Safari. Check it out to see if there's something you missed:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    <TITLE>A simple frameset document</TITLE>
    <FRAMESET cols="20%, 80%">
      <FRAME src="frame.htm">
      <FRAME name="bob" src="">
          <P>This frameset document contains:
             <LI><A href="contents_of_frame1.html">Some neat contents</A>
             <LI><A href="contents_of_frame3.html">Some other neat contents</A>
    (Left frame)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    	<div><a href="" target="bob">Go to macrumors!</a></div>
    I just found out that there's no target attribute on xhtml strict, so make sure that you are not using the strict doctype ;)
  3. Sean7512 macrumors 6502a

    Jun 8, 2005
    I had the same problem...After a bit of searching the internet, I found a EASY solution. Where you name your iframe, you need to include an "id" attribute that has the same name as your iframe. For example:

    <iframe frameborder="0" src="home.html" width="100%" height="500" id="bob" name="bob"></iframe>

    For whatever reason, Safari will not recognize the name attribute for a iframe. You need the id attribute. Make sure you use both name and id, otherwise other browsers will not work.

    EDIT: Then you would use the code the exact same as you have it (with the target="bob")

Share This Page