开发者

Links opening page *over* current page

I have a website (here: http://kitandmarcin.us) with links to a variety of external pages. So far, so normal.

However, when one clicks on a link, the address bar doesn't change, and for some of the links, it is clearly painting over the current page (my page shows through transparent parts of the target page).

I get this behaviour in FF5, and Chrome. Investigating the structure of the document in Chrome (but not FF+firebug) shows that the embed element changes from containing the SVG to containing the target page. This behaviour was not present in earlier versions of Chrome, nor in FF3 or 4.

The one twist that my links are embedded in SVG, which is embedded in the page.

The xhtml which embeds the svg:

<embed type="image/svg+xml" id="svg2" data="wedding_layout.svg" src="wedding_layout.svg"/&开发者_高级运维gt;

A fragment of the SVG document, which embeds the xhtml:

<foreignObject id="foreignObject4221-Gifts" width="225" height="175" x="689.48" y="375" class="body-box">
    <html:body class="body-body" style="text-align: center;width:100%;">
      <html:div style="text-align: center;border-style:none;width:100%;" class="body-cell"> <html:p>Gifts are not expected, but will be gratefully received</html:p><html:p>We have registered with <html:a href="http://www.williams-sonoma.com/registry/2812940/registry-list.html">Williams-Sonoma</html:a> and <html:a href="http://www.jonathanadler.com/giftregs.php?eventid=1421">Jonathan Adler</html:a></html:p>
      </html:div>
    </html:body>
</foreignObject>

Is there any way to stop this without using javascript? For example, can I use a target property on the a tags somehow?

If javascript is the only way, is there anything I should know about?

Update: A quick test shows that FF5 and Chrome on windows respect the target="_top" attribute, and load the links as expected if that is set.

Update 2: This also seems to work with FF5 on Mac.


You can use target="_parent" or target="_top" on the embedded html anchors to navigate to the link in the current page. This eliminates the unexpected behaviour you were encountering.


You could use target = "_blank" which will open in another browser window...


[Remove/Delete all]. [stop all process/kill]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜