| View previous topic :: View next topic |
| Author |
Message |
typoz
Joined: 21 Jul 2009
Posts: 4
|
| Posted: Tue Jul 21, 2009 1:25 pm Launch in new window without using <A target=_blank> ? |
|
|
I have the following challenge:
I am displaying content in an iframe on a page. I need the links that appear in this iframe to launch into a new page, but instead they launch into the iframe itself.
I can't place target=_blank on the anchor tags of these links because they are coming from a third-party syndicate that can't change its feed just for me.
Is there any way to tell all links within the iframe to launch out into a new page? An attribute of the <iframe> tag, perhaps? Or maybe a CSS trick?
Thank you to anyone who can provide some help...
Greg |
|
|
PayneLess Designs
Joined: 28 Feb 2007
Posts: 3597
Location: Biloxi, MS
|
| Posted: Tue Jul 21, 2009 6:33 pm |
|
|
| Try putting this inside the link tags instead: Code: Open new window: onclick="window.open (this.href, ''); return false" |
|
|
typoz
Joined: 21 Jul 2009
Posts: 4
|
| Posted: Tue Jul 21, 2009 6:38 pm |
|
|
| Thanks, but like I said, I don't have control of the links themselves. They are coming to me as part of a feed. I can't insert anything into the anchor tags. I am trying to find some way to put code either before or after the feed (or as part of the iframe tag) to set all links contained within to launch into a new window. But again, I can't actually change the link tags themselves. Any other ideas? Thanks... |
|
|
PayneLess Designs
Joined: 28 Feb 2007
Posts: 3597
Location: Biloxi, MS
|
| Posted: Tue Jul 21, 2009 7:04 pm |
|
|
| Sorry. Answered too quickly. If the page being displayed in the iFrame is external, then you have no control over the external links. |
|
|
typoz
Joined: 21 Jul 2009
Posts: 4
|
| Posted: Tue Jul 21, 2009 7:11 pm |
|
|
| The iframe is displaying a page that I control. It's basically just a page that calls a JavaScript from a third party. So I could put something within the iframe on the page I control. But I can't put anything into the actual anchor tags for the links themselves. (If I could do that, this would be much simpler, of course.) I am just wondering if maybe there is a css style I could wrap around the Javascript call that would cause all the links that it brings in to be modified. I haven't found any css like that so far, though. Again, any help is much appreciated. |
|
|
sticks464
Joined: 31 Dec 2006
Posts: 2311
|
| Posted: Tue Jul 21, 2009 7:21 pm |
|
|
| Sounds like you want control of an rss feed that has links to different sites/pages etc. As Ron said if you do not have access to the actual link code there is nothing you can do with css, javascript or any other language to get a new window to open. |
|
|
PayneLess Designs
Joined: 28 Feb 2007
Posts: 3597
Location: Biloxi, MS
|
| Posted: Tue Jul 21, 2009 7:24 pm |
|
|
CSS is for presentation only. Not to control scripts or other active content except for the styling of that content.
If you don't control the page directly, and by that I mean have access to editing the page called in iframe, then you can not control another site's link behavior.
There are scripts to control how browsers act on a link, like the one I gave, but to force a page inside an iframes to act the same way is somewhat different. |
|
|
typoz
Joined: 21 Jul 2009
Posts: 4
|
| Posted: Tue Jul 21, 2009 7:26 pm |
|
|
| Thanks for the responses. The other approach I could take to my problem is to take the code out of the iframe. Then I wouldn't have to worry about the link target, but I have a different problem. The Javascript that is loading into my page is so slow to load that it delays the rest of my HTML page from finishing its load for about 10 seconds. Is there a way to call a Javascript but delay it from loading until the rest of the page is done? My method was to put it inside an iframe, which did the trick but led to this problem with link targeting. I'd be happy to solve the problem by just getting the JavaScript to load after the page finishes. Any ideas? Thanks so much... |
|
|
PayneLess Designs
Joined: 28 Feb 2007
Posts: 3597
Location: Biloxi, MS
|
| Posted: Tue Jul 21, 2009 7:42 pm |
|
|
Not sure if these is of any help:
JavaScript: Delay Loading
Speed Up Your Javascript Load Time
Might add this, defer="defer", to the script tag. |
|
|
| |
|
|
|