This question is for advanced javascript programmers! -Sorry for my bad english :(
We have the following scenario:
--- Site A gives me a script.
--- I put the script on site B (on index.html)
--- The script generate an iframe, that contains a link(< a >)
Result => Site B contains an ifame with a link in it ,from site A
All i want to do is "To open the link in new tab" :D
I can do this by adding with javascript attribute target="_blank".. BUT i CANT select the link() with javascript because the iframe is from another site. For security reasons browsers dont let you to access the content of an iframe if is not from your site.
I am loking for some sort of a hack... I was thinking if playing with events will help me ?
Like catching the event of link click, than stop the event and than fire new event to open link in new tab.
Or catch the leftclick event, stop event, fire right click event than, from the cotext menu select "open link in new tab" (all of this happens when user leftclick the link)
Any suggestions are welcome, i need to look this problem from a different perspective...
You could use a proxy. Here is the code that I use:
get.php
You can use it by passing it the link:
As you can see, the URL that is passed should be urlEncoded. Also note that any relative paths in the other page will fail to load (you could improve this by replacing any relative path by an absolute one).