I am planning to create some dynamic content in a Facebook tab for my fan page. It should have content displayed if the visitor is not a fan, and then upon them clicking the Like button, changing the content to display hidden carrots (metaphorically). Is it possible to capture the event of the click on the Like button from inside the iframe?
On a Facebook fan page, when the user clicks the Like button, the whole page gets reloaded and Facebook sends an HTTP post to your website with a parameter called signed_request that you would need to decode and look at with server code, not javascript. The code to decode it will obviously vary depending on what language you are using, but the process is documented on Facebooks site. Once decoded, you will need to look at the page.liked value.
Related
I have a link that on entering it (click/tap), is a confirmation to pay.
The link is sent by sms to the user.
The problem starts when the link is being displayed as a rich preview url, that causes the link to be visited and the user will be considerd to confirm the payment.
Just so you can get a clue as for what is a rich preview (https://richpreview.com/). It happens in messaging services like WhatsApp and iMessage when they display the content of the link before you open it. It complies to the open graph protocol explained here: http://ogp.me/
The question is: how do I disable this rich perview from my end (server side) or how do I detect that this request is for rich preview so that I could ignore the payment confirmation?
One of the suggestions from Google searches was to simply locate the url link in the middle of the text, will it work in all cases?
I had the idea of creating a new page that will redirect (by script) on render to the actual payment confirmation page, is it possible or will the rich preview run this script as well?
Thanks
Removing the http:// or https:// off the front of the link will cause Whatsapp to disable rich link previews.
Unfortunately, using redirects probably won't work. Pretty much, what the rich link does, is it opens its own mini web browser and opens the page for you. If you have redirects the app will just follow these.
Before sending the link, make the server put a dot and a space before the link and a space and a dot after it. See the example:
Sending a the link like this (http://www.bbc.co.uk/news/uk-40909057) will produce a rich link, like this:
However, if you send the same link, just with the dots
(. http://www.bbc.co.uk/news/uk-40909057 .) it does this:
Note: the messaging service removes the dots automatically when it acts upon them, so they don't appear in the message the recipient sees.
I think this should work for you, please get back to me when you have checked it.
The thing that did the trick was based upon the user agent of the request to get the preview.
All the requests for rich preview were from a non-mobile device,
since the platform is solely mobile based, the solution was to detect the user agent and "block" the automatic charge for the user with the non-mobile ua.
instead a button was presented to continue the charge procces for the cases that the device was not recognized as mobile but the proccess now continues with the user intent.
I couldn't find anything about this topic, maybe because I'm not a good english speaker and can't find the right words to search for in google therefore.
I'm currently working on an Chrome browser extension which enables me to search for user accounts on a specified web page by using the context menu. Example: If I select the text name123 on any webpage and click the context menu entry, a new tab http://www.webpage.de/user/name123/ is opened.
Now I want to extend the extensions capabilities: I want to search for email addresses, too. For that I can use http://www.webpage.de/search/name123#mail.com/ which brings up a list of all user with the email address name123#mail.com. From there, I could extract the link to the user account as follows:
document.getElementsByClassName("xyz")[0].href
My question: Can I skip the loading of http://www.webpage.de/search/name123#mail.com/ and the "extraction" of the url to the user account? Respectively, can I hide the procedure of opening this additional web page? Does JavaScript support any kind of "preloading" of a webpages content, without being displayed in the browser?
If you can parse the required link from raw HTML, you can fetch the page via an XMLHttpRequest in the background page, examine the result and then open the real profile page.
If the page is dynamic and you need its scripts to run before you can extract the link, you can load it in an iframe in the background page and examine it.
You can do it.
Add permessions to your manifest.json file: 'http://www.webpage.de/*'
Create neccesary ajax requests from background script.
I need to get the status of a twitter "follow" button on load, not on click.
I'm currently loading the button via ajax, and call twttr.widgets.load() to get the widjet.js to do it's magic.
I am aware of binding "follow" and "unfollow" to accept the callbacks from clicking the buttons, but how do I detect the current state of the button before any user interaction?
For instance, the page loads and the user is signed into twitter and currently following the target of the follow button, so it appears that they've already followed the user.
How do I detect this with javascript/jquery? I am not authorizing them through twitter at this point, so I can't check via their api.
Other attempts:
I've also tried getting the contents of the iframe via javascript,
since the twitter follow button iframe has a class specifying the
state of the button, but it doesn't seem to be possible due to CORS.
I expect the answer is you can't.
The twitter follow button is in an iframe expressly to prevent you from accessing it and obtaining information they don't want you to have.
Facebook operates similarly. The like button is in an iframe, and therefore you cannot use it to determine if a person has 'liked' a particular page. That information requires permission from the user.
I am trying to add a Pinterest button onto a product page for a single image in a Facebook Tab app.
The Pinterest code is grabbed from their goodies section, and must include a URL, the Media URL and the Description.
I am not that proficient with Javascript. I am trying to pull the URL and insert into the Javascript button for a single item. Please see below; Thanks.
Pin It
Since you trying to get Pinterest button working in Facebook Page tab this will not work due to inability to know which Page you're on in JavaScript.
This info is passed to server with signed_request. You have couple of options to do so:
Build the link to page that will be linked to "Pin" server-side
Pass information about Page and Page Tab to client side and build the link here.
Beware that this is just a link and it will not looks like Pin-It button until you including Pinterest JavaScript (//assets.pinterest.com/js/pinit.js) on a page. If you build that link in Client Side you must include that JavaScript after, so link will be replaced by iframe with actual Pin-It button.
I have two websites (ASP.NET MVC 3, but I don't think that's very important). The first one has a button; when the user clicks that button, the site needs to make a POST call to the second website and display the result in a popup. The result is a wizard of sorts - it has several steps that require clicking buttons. The final step should close the popup.
My main problem is: how can I make the popup AND the POST? I can do a POST from the code-behind in my first site, but if I just display the resulting HTML in the popup window (replacing its content or something), the browser still knows that the page came from the first site, so the next button click tries to go to the first site. I need the popup to know its contents came from the second site.
Is this possible?
View Site A in browser. POST to Site B. Site B sends minimal HTML to browser, and that HTML creates the popup.
Does that help? Can clarify further if needed.