In my application an external website places link in my web page and the link does not have target=_blank. More specifically its iframe in my webpage whose src is another domain which I have no control. The content in this iframe contains links that opens in the same window wiping off my ajax driven web page and taking the user to the other domain. Is there a way to intercept this ( via javascript? ) and make the link open in another window or browser tab? It would be even much better if the link opens within the same iframe on my webpage. Is this possible? Is target="_self" makes the link open in the same iframe?
0
votes
2 Answers
1
votes
0
votes
** To open an url in a new tab with target attribute
<a target="_blank" href="http://www.google.com" title="">
Click here for new tab
</a>
** To open an url in a new tab without target attribute.
<a onclick="window.open(this.href,'')"
href="http://www.google.com" title="">
Click here for new tab withouth target attribute</a>
** To open an url in the same frame.
<a target="_self" href="https://jsfiddle.net/" title="">
Click here to open in the same frame</a>
Please find the jsfiddle it works fine
jsfiddle