Is there an analogue of mailru.app.events.like for sites?

Social networking — great marketing tool, but sometimes they don't want to give their functions the ability to save the user. My task is: there is an online store, there is a like button (pretty standard, i.e. not in the form of their own bike that on click asks permission to add the husky, and the usual such buttons). You need to intercept the event licania and otlichnie, namely pressing "like" using ajax to load a one-time coupon code for a discount and to show the user.

If the store was an app, it would be easy — there is an event mailru.app.events.like, but for sites of this event no. Like/dislik create cookies, but they are for domain *.mail.ru. The buttons are in an iframe, the contents of which also can not be obtained.

Maybe somebody faced with such problem — prompt as it is possible and whether it is possible to implement.

The moral side of the question: social networking is NOT against the encouragement of clicks on "like" if everything is fair for the user.
October 8th 19 at 01:35
2 answers
October 8th 19 at 01:37
If, for example, to use jQuery, you can do this:
$("iframe").contents().find("#like-button").click(function() {
 //your code 
});

If the page in iframe s not one, then the selector obviously needs to be clarified.
Unfortunately, my domain is not mail.ru, en.wikipedia.org/wiki/Same_origin_policy - ibrahim.Jones24 commented on October 8th 19 at 01:40
Yes, my bad, totally forgot about it... - Josie_Little commented on October 8th 19 at 01:43
October 8th 19 at 01:39
* Caught a widget that inserts the iframe with buttons in front of the tag "a". - ibrahim.Jones24 commented on October 8th 19 at 01:42
Thanks, I'll try, but I was hoping there is some method provided for by mailboxName. For (stimulating social activity of users in exchange for a discount) I found another method — the use of api.mail.ru/docs/reference/rest/stream.share/ — people will click on the button "Get a discount" to open a window with a request to add references to the ribbon if the user allows it comes history_id, and in response, I generate a discount coupon. - Josie_Little commented on October 8th 19 at 01:45

Find more questions by tags ProgrammingMail.RuSocial networksFacebookJavaScript