dialogsharelinkedin-apicustom-urlnew-window

I need to open LinkedIn share in new window NOT new tab using custom URL


I'm am developing a site containing videos embedded from youtube, each with sharing options. The client will be updating the videos so CMS is attached and the URL dynamic, for this reason I'm using the Custom URL method from here; https://developer.linkedin.com/docs/share-on-linkedin

I've created a jsfiddle which is basically what I have except the youtube video id is set, functionality isn't perfect but works enough to describe my issue, code below. https://jsfiddle.net/Harvey89/qd7tqc96/

<a target="_new" class="lisharelink" data-shareurl="https://youtu.be/ZxGXs63wzBQ"></a>

$('.lisharelink').click(function() {
  var shareurl = $(this).data('shareurl');
  window.open('https://www.linkedin.com/shareArticle?mini=true&url=' + escape(shareurl) + '&title=' + document.title + '&source=SourceTitle&target=new');
  return false;
});

So basically it opens in a new tab, not a new window. Does anyone know of a way to force it into a new window?


Solution

  • When you specify a width/height it should open a new window.

    Try this:

    $('.lisharelink').click(function() {
      var shareurl = $(this).data('shareurl');
      var windowName = 'Test';
      window.open('https://www.linkedin.com/shareArticle?mini=true&url=' + escape(shareurl) + '&title=' + document.title + '&source=MadeInTheMidlands&target=new', windowName, "height=200,width=200");
    
      return false;
    });