Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open the Facebook login window in new Tab on clicking the Like Button

How can we open the Facebook window in new Tab instead of opening in 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>

Issue is - On clicking the Like Button, opens the Facebook login window in new Window. How can I open it in new Tab

My JSFiddle is here

like image 522
Pankaj Avatar asked Feb 20 '23 00:02

Pankaj


1 Answers

Try this code, its working 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 from href.

like image 180
Sathishkumar Avatar answered Apr 08 '23 20:04

Sathishkumar