开发者

svg: Open (a xlink:href) another svg image in current frame - cross browser nightmare?

I have been bashing my head against this problem for awhile now and I was hoping for some help/advice.

I have an svg graphic which I have embedded into an iframe (icky I know, but we have created our own dashboard/widget application, and this was the easiest way to port our existing svg framework into the widget). I need to be able to have those svg graphics link to other svg graphics, and I need them to open in the same iframe, which at the moment is driving me mad.

I found this post which talks about methods of linking in svg, however, the comparison at the bottom seems to indicate that it is impossible in IE (7 at least) to have a link open in anything but the "current window". This seems to be the case in everything I have tried, but was hoping that somewhere out there in internet-land, someone has found a work around for this.

Here is what I've tried:

1. <a xlink:href='<path to new embedded graphic>' target='<iframeName>' ... />

Chrome 13: Works perfect, opens in correct frame!

Firefox 6.0.2: Attempts to open in a new tab

IE 9.0.8: Attempts to open in a new tab

2. <a xlink:href='<path to new embedded graphic>' xlink:show='replace' ... />

Chrome 13: Replaces the svg graphic with my desired file, however, since I am replacing with an ASP page that contains the embedded svg graphic, I end up getting a 'nested' effect on my page.

Firefox 6.0.2: Similar to Chrome - loads in place but nesting occurs, although in FF the graphic does not even load.

IE 9.0.8: Similar to Chrome, loads in place but nesting occurs.

It seems as if setting the target frame is the way I want to go, but is there anyway to make it work in FF and IE? Has anyone been successful with this?

The other thing I am attempting to try is setting the frame's window.document.location.href in javascript when t开发者_StackOverflow中文版he link is clicked. It's proving tricky to do though, and I have really only been attempting in Chrome. I was hoping for some advice before I wasted too much time on it.


Turns out the following worked just fine for me in IE9, Chrome 13 and FF 6:

<a xlink:href='<path to new embedded graphic>' target='_parent' .../>

This opens up the graphic in the parent window, which happens to be my iFrame.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜