share (type: PP.Ui.ShareType, url, title)
type. Social network to which a message is published. An instance of PP.Ui.ShareType enumeration
url. Link to the page to be published. By default the link refers to the current page.
title. Title for the published message.
The share method publishes a link to specified page to a selected social network.
To execute the example, the page must contain the DiscussMenu component named shareMenu (see Example of Creating the DiscussMenu Component). Add a button, clicking which publishes a message to LinkedIn:
var but3 = new PP.Ui.Button( { Content: "Publish to LinkedIn", ParentNode: document.getElementById("btn3"), Click: function () { shareMenu.setAutoShare(false);//on menu item selecting, there is no corresponding social network opened shareMenu.setTitle("My report");//Set title to published message
shareMenu.setUrl("http://pp:8080/r7/app/scorecard.html");//set link for publication shareMenu.share(PP.Ui.ShareType.LinkedIn, shareMenu.getUrl(), shareMenu.getTitle());//publication } });
After executing the example clicking the menu items does not publish a message. Clicking the Publish To LinkedIn button publishes the link set for the menu using the setUrl method. Title of the published message: My report.
See also: