Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display Linkedin Share in small window

I want to display LinkedIn popup in a small new window, but the share popup keeps opening as a new full screen tab.

This is the piece of HTML I'm using:

    <div class="share-block">
        <a 
            href="#" 
            onclick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(document.URL) + '&title=Excellent review on my website reviews', '_blank, width=500, height=500, resizable=yes, scrollbars=yes'); return false;"
        ><i class="fa fa-fw fa-linkedin"></i> LinkedIn</a>
    </div>

I'm using the same code for Facebook and Twitter which opens up the popup in a new small window as it should. This is the Twitter HTML for example:

    <div class="share-block">
        <a 
            href="#" 
            onclick="window.open('https://twitter.com/intent/tweet?text=Excellent review on my website:%20'  + encodeURIComponent(document.URL), '', '_blank, width=500, height=500, resizable=yes, scrollbars=yes'); return false;"
        ><i class="fa fa-fw fa-twitter"></i> Twitter</a>
    </div>

I can't figure out why doesn't it work with LinkedIn. This is what I want to achieve enter image description here

How to display LinkedIn share in new window like shown on the image?

like image 999
Mario83 Avatar asked Sep 15 '25 14:09

Mario83


1 Answers

The second argument in the window.open is for title. You missed that in your linked in popup. So that it treat as all the _blank, width=500..... everything as title. That is the reason it is not following any property width and height and etc. Add that empty string as the second parameter ''.

Fiddle DEMO

like image 136
Suresh Ponnukalai Avatar answered Sep 17 '25 06:09

Suresh Ponnukalai