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.
Related
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'm basically trying to make one link on my page and when the user clicks the link it will direct to one of these links depending on what device they are coming from.
So the link says "Download Now" and I need it to launch these URL's depending on the user agent device
If Android then android.com
If Windows then windows.microsoft.com
If Apple then apple.com
I am trying to avoid using PHP to accomplish this.
Any suggestions?
You can use the navigator.userAgent and created a method to search for android/iPhone/WindowsPhone etc string within the userAgent string. You'll need to research these online and get a list of all mobile devices and redirect based on that.
You can use the User Agent from JavaScript and intercept clicks on links, redirecting to a page depending on what User Agent is detected. Here's some code to give you an idea: Change link destination based on whether user has mac or PC. Here's a link to various User Agents which may be useful: List of User Agents
Make sure that the link still has a valid href attribute though in case the user disables JavaScript. Another possible approach is modifying all the links: changing the href attribute on page load to fit the User Agent.
I am sending an email that includes a link. When the recipient clicks that link, I'd like the resulting page to come up pop-up (rather than open in a new tab) when clicked.
I'm using Gmail as my reference mail client.
Things I've tried:
target="_blank": opens in a new tab, not a pop-up
<a onclick="window.open(...)">: stripped out by gmail.
<a href="javascript:window.open(...)">: stripped out by gmail.
opening a new tab, and then generating a pop-up from that tab via onLoad or similar: pop-up blocked.
Most popup-related online resources I've found so far have been quite out of date, but the rule of thumb appears to be "if an event is
user-initiated, it will be allowed to open a popup."
Even a partial solution (only works in Chrome/Firefox/Safari/etc) would be better than nothing.
Almost all mail clients strip out inline JavaScript because it is vector for malware.
You can only include regular links in Emails.
I've been having an issue with the Facebook Like button for quite some time. I've looked all over for a solution but am quite stuck. The error occurs on my site www.MapYourVote.com. When you go to a poll page and click 'Like' the dialog appears and quickly disappears. At the same time, the counter also goes to 1 and quickly goes back to 0.
The problem is always solved for individual poll pages by using the Facebook Debug tool (http://developers.facebook.com/tools/debug). Once you use it on the url, the like button will work as expected. The issue is my website is dynamic and I can't use the Facebook Debug tool every time someone creates a new poll. The Facebook Debug tool does not reveal any problems (apart from og image size but I doubt that's the issue).
Here is an example of a page in which the Like button does not work. If you were to enter this url into the Facebook Debug tool, the Like button would work.
http://www.mapyourvote.com/Poll/Election-Result-Feelings/
Any help would be much appreciated!
I also had this problem. I was constructing a referrer url to give link-sharers a credit, so there was a different url for each user that wanted to share something. The referrer link would give the user credit and redirect to the login page of my site. With this configuration, the like dialog would appear for a moment and then disappear again, unless I went to facebook's debug tool.
What fixed the problem for me was to change from a redirect to rendering the page directly from my referral link. In fact, I changed the referral link to be a ?r=refid parameter on my root page URL. It appears to work correctly if facebook doesn't have to follow a redirect to get the og: data.
I had a similar problem and it turned out I had too restrictive cookie policy set in my browser - I only allowed Facebook to use 1st party cookies. When I allowed Facebook to use other cookies, the problem was solved. It's hard to debug when no error appears other than the immediate pop-up closeup.
I had the same problem. It was caused by url value in data-href attribute. I had there url pointing to my localhost.
When I changed the url to existing one, problem was solved.
Hope it helps
For me, the problem (Like popup disappearing after a second) was happening when the Like button URL redirected to another URL.
The fix was to add og:type, og:url, and og:title (required per https://developers.facebook.com/docs/reference/opengraph/object-type/website), then running the URL through the Facebook debugger to clear the cache (https://developers.facebook.com/tools/debug).
More at https://stackoverflow.com/a/16597060/2391566
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.