Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Open a new tab from Iframe?

I have a website build in php, in some page i show a iframe with another website link, which displays it's login screen.

Both Websites are in different domain.

Like main website : http://www.abcd.com Iframe href : http://www.xyz.com

Now my users see a page in abcd.com where there is an iframe like <iframe src="http://www.xyz.com/" style="width:688px; height:384px;"></iframe>

Which displays the login screen of the xyz.com

Now what i want is, if users login to xyz.com another new tab should open with the homepage, after login of xyz.com and abcd.com tab should get close.

Is it possible to do with javascript or jquery, which works for all the browser including IE 7,8,9 ??

Thanks

like image 286
Rahul Ukil Avatar asked Feb 13 '13 14:02

Rahul Ukil


People also ask

Can I open new tab from iframe?

By adding target="_blank" to the anchor, it will open it in a new tab. By adding target="_parent" to the anchor, it will open it up in the same window like a normal link.

How do I open an iframe in a new window in HTML?

You can do it with jquery and window. open method. JS : var iframe = $("#iframe"); var newWindow = window.

How do I open an iframe window?

If you want to open a window within an iframe :<! DOCTYPE html> <html> <head> <script> function openWin() { myWindow=window. open(bing.com,'','width=200,height=100,resizable=yes,too…); myWindow. document.

How do I open a link in an iframe?

You can embed an iframe in a page that is inside another iframe on another web page. When you set the target attribute to _parent, the link will open in the web page that is holding the iframe. In most situations with iframes, this target will open links in the same way that the _parent target does.


1 Answers

Open up a new tab

link

<a href="foo.html" target="_blank">linky</a>

pop up

window.open("foo.html", "_blank");
like image 159
epascarello Avatar answered Sep 28 '22 08:09

epascarello