简体   繁体   中英

How can I force Facebook's stream.publish dialog to always open in a new tab or window?

I have a link with this listener:

    $('#share-via-facebook-trigger').click(function () {
      FB.ui(
      {
        method: 'stream.publish',
        attachment: {
          name: "<%= "name" %>",
          caption: 'caption',
          description: "<%= "desc" %>",
          message: "some message ",
          href: "some href "
        },
        action_links: [
        { text: "<%= "text" %>", href: "some url" }
        ]
      },
      function(response) {
        if (response && response.post_id) {
          //alert('Post was published.');
        } else {
          //alert('Post was not published.');
        }
      }
      );
    })

If the user isn't logged in to facebook, the link opens in a new window. If the user is logged in to facebook, a dialog opens next to the link right on the page and it get clipped and looks very ugly. How can I make sure the dialog always opens in a new window?

I've tried adding a target="_blank" attribute to the link, but the problem remains. I'd appreciate any help.

You can perform the same with plain url like this one . So all you need is just to create a link with target="_blank" and such URL.

Comprehensive list of parameters and theirs values you can find in documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM