How to open Facebook login window in a new tab when you click Like

How can we open a Facebook window in a new Tab instead of opening in a new window ?

My HTML is below

 <div style="position: relative; top: 3px;" id="likeButton"> <iframe frameborder="0" scrolling="no" allowtransparency="true" style="border: none; overflow: hidden; width: 260px; height: 35px;" src="http://www.facebook.com/plugins/like.php?href=http:\\localhost\login.aspx|@&amp;send=false&amp;layout=button_count&amp;width=100&amp; show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=35"> </iframe> </div> 

Problem . When you click Like Button , the Facebook login window opens in a new window. How to open it in a new Tab

My JSFiddle is here

+4
source share
2 answers

Try this code, its work for me.

 <a style="position: absolute; top:0px; left: 0px; width:100px; height:40px; cursor:pointer;" href="https://www.facebook.com/login.php?skip_api_login=1&display=popup&social_plugin=like&external_page_url=http%3A%2F%2Finvalid.invalid%2F&next=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Fuiserver.php%3Fmethod%3Dopt.inlike%26app_id%3D127760087237610%26display%3Dpopup%26social_plugin%3Dlike%26secure%3Dfalse%26protocol%3Dhttp%253A%26external_page_url%3Dhttp%253A%252F%252Finvalid.invalid%252F%26from_login%3D1%26client_id%3D127760087237610&rcount=1" target="_blank"></a> <div style="position: ansolute; top: 0px;z-index:0; cursor:pointer;" id="likeButton"> <iframe frameborder="0" scrolling="no" allowtransparency="true" style="border: none; overflow: hidden; width: 260px; height: 35px;z-index: 0;" src="http://www.facebook.com/plugins/like.php?href=http:\\localhost\login.aspx|@&amp;send=false&amp;layout=button_count&amp;width=100&amp; show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=35"></iframe> </div>​ 

Working example: http://jsfiddle.net/JpWCf/

Change the external_page_url parameter on the href page.

+6
source

I'm afraid I have to agree with other commentators. You cannot control how the browser handles the Facebook request in order to open a new window of a certain size. By default, however, it usually opens as a small popup to honor the window size request.

What I managed to do was: Example, to capture a click on the Like button and open something else - in a new tab . This is not what you want, but it can help you get started in the right direction.

Now you need to figure out a way to open a page that is trying to please your page.

It really burns out how badly you need it to happen on a new tab, not pop up. Maybe the solution that will lead you to this requirement needs some rethinking?

+2
source

All Articles