I have an iframe with a site from a different domain. The iframe src contains links that I would like to open in a new window when clicked. Unfortunately, I can't get the target.href of the links. I think this should be possible since right-clicking the link and selecting open in a new window works. How can I make a regular left-click mimic the behavior of a right click->open in new window?
I can intercept the click using the iframe's onfocus property but I can't get the href of the link.
Here's a snippet of my iframe:
Expand|Select|Wrap|Line Numbers
- <iframe id="gadgetFrame" onfocus="bringLink(gadgetFrame)" ...
Expand|Select|Wrap|Line Numbers
- function bringLink(id) {
- if (event == null)
- event = window.event;
- var target = event.target != null ? event.target : event.srcElement;
- alert(target.href);
- //open(target.href);
- }
Thanks,
LizF