im trying to launch my app when user taps on link on email .. i've seen many posts like this but i can't seem to get it to work .. there's a problem i've been encountering, if the link i send is https://www.google.com (or any other valid websites), when i tap on the link, it works. It launches safari then goes to the site.. but if i replace it with my urlScheme, the body in the email appears to be not read as a link .. by the way.. im creating the email message in the client side .. here is sample code..
Nsstring *htmlBodyWebsite = #“<a href=\”https://www.google.com\”>Click here</a>" < working
Nsstring *htmlBodyUrlScheme = #“<a href=\”myApp://\”>Click here</a>" <not working
// when i enter in safari browser - myApp:// << working
so it seems that i've setup urlscheme correctly since when i entered myApp:// in safari, it prompted me to launch my app.
so the process here is, i create the email message in the client side... then our server receives it and sends it via email to target recipient..
now when the recipient receives the email, here are some observations i've made..
when i send htmlBodyWebsite, it works fine. Using google chrome browser and in the email message itself, when i right click, then inspect, i would be able to find the referenced link with proper tagging
but with htmlBodyUrlScheme it doesn't have proper html tagging
thanks
it seems to work if i tap on the link using the ios built-in Mail app.. neither using safari to open gmail.com nor gmail app doesnt make it resolve this issue..
Related
When using Safari (iOS 10.2) and clicking on a mailto link a confirmation prompt is shown with the following message:
"This website has been blocked from automatically composing an email."
Ignore / Allow
I'd like to get rid of this on my own site and don't know what to do. It can be reproduce with Safari e.g on any BBC article clicking the mail icon.
Screenshot of dialogue on iPad
My web research brought me to these links:
https://discussions.apple.com/thread/7763735
WillieFromColo Jan 11, 2017 8:25 AM in response to Russ G
Issues with Safari and "This website has been blocked from
automatically composing an email."
My research on Google suggests that this Error-type Message started
happening in about November with an update to Safari, which likely
occurred concurrently with Apple's update to iOS 10.2. As of today
(1/11/17) that is the latest version of iOS for iPads and perhaps
iPhones, too.
[...]
and
https://developer.apple.com/safari/technology-preview/release-notes/#r15
Release 15
URL Handling
Navigations to tel: and mailto: links now require a user gesture;
navigations without a user gesture will show a confirmation prompt
So it seems like a Safari "feature". Does anyone know how to prevent this prompt?
Various third party JavaScript libraries will intercept clicks on a tags in order to prevent navigation briefly while sending data to a server. Typically, they programatically trigger navigation via window.location.replace.
The change in Safari pops the warning when mailto/tel links are triggered in this way.
There was an interaction, but that's usually been stopped with preventDefault, and Safari doesn't care.
If you're using a library that's causing this issue, contact the creator and see if they can update it to skip preventDefault on mailto/tel links.
What i did not mention initially was that we called the mailto from the JavaScript part of out page. We now again tried to solve the issue by changing to a HTML Tag based mailto (with to and subject) and it now somehow works without that dialouge.
So i assume this issue solved for myself, but i am open to any hints explaining the reasons. Therefor by now i do not flag this answer as the solution.
Happened for users because we used window.open(...) to open that link in new window.
Replaced to window.location.href = ... just for Safari :facepalm:.
We have encountered a similar issue - and have identified the issue as being triggered via Google Tag Manager.
Specifically we were triggering the event (in Tag Manager) on all href elements that contained a mailto: prefix.
We altered the event to be triggered via a click on a nested <span> element inside the anchor tag.
This allowed both the tracking of the event in Tag Manager and removed the offending user prompt.
eg.
<span>link text</span>
We got this issue when tracking mailto-Links with Google Tag Manager.
I've found a solution without modifying the dom.
We had activated the trigger type "Click - Just Links" with the option "Wait for tags" with a "Max wait time" of 2000 Milliseconds.
After disabling this option, the message did not show up again.
Another solution is to use "Click - All Elements" (this always works).
None of the solutions in here worked. There was a plugin/script that was attaching itself to click event which was causing this behaviour. I finally used jquery to create the mailto: links with jQuery.
Add emails in html in this manner
<span class="email-link">email#email.com</span>
and add this jquery to transform the <span> to a link
$(function() {
$( ".email-link" ).each(function( index ) {
var a = $('<a />');
var link = $( this ).text();
a.attr('href', 'mailto:' + link );
a.text(link);
$( this ).html(a);
});
});
This way you can avoid any external scripts attaching to the mailto link click event.
I'm having an issue trying to send Whatsapp messagges through browser using this code:
click
Using this code, Whatsapp opens correctly but the number is not recognized (i'm trying with my number, which is registered in Whatsapp) saying something like "You're trying to reach a non-Whatsapp number. Invite him or send SMS".
My international code (Italy) is +39.
I've tried 003912345, +3912345, 3912345, 12345, but with no success.
Anyone experienced this? Thanks for the help!
You get the message"You're trying to reach a non-Whatsapp number. Invite him or send SMS" because the number you want to use for sending the message to must be present into your phone contact list.
Anyway the attached code you use for the link won't work on iOS.
Try to use: href="whatsapp://send/?text=<>" data-action="share/whatsapp/share" . The link will open WhatsApp but you will have to manually select the consignee of the message from your contact list, otherwise you could use the ABID code to send the message directly to your contact.
Here you'll find more info about this technique: https://www.macstories.net/tutorials/use-whatsapps-url-scheme-with-drafts-launch-center-pro-or-a-bookmarklet/
My ActionHandler.ashx file should be POSTed yet upon entry to ProcessRequest the context.Request.RequestType is always "GET".
Background:
This HttpHandler currently works OK (i.e. clicking a link in an email causes my ActionHandler.ashx to be entered and the querystring is processed correctly). For example:
https://mdwdata/CorporateBrain/ActionHandler.ashx?Action=MarkComplete&ID=1024~nzmewoojgnn&CUID=13
is the URL for the link shown as Mark-Complete in the image just below:
But now I am trying to improve it by following this advice in a previous SO thread :
"In the body of the email, instead of sending a link, include an HTML form that contains a button which performs a postback to your server."
Problem Summary: When I click the Submit button, my handler is entered with verb GET not POST (hence, I have no access to the hidden form data in the Request.Form collection.
Here is a snippet (image) of the email body
If I can get the Submit to post the hidden form variables to my handler, then of course I would remove the links. In the debugger, I verified the form data and it looks good me:
I added this line to my web.config file:
<add path="ActionHandler.ashx" verb="GET,POST" type="System.Web.UI.SimpleHandlerFactory" validate="true" />
Also, my email client is Thunderbird.
What would cause the request to be GET instead of POST?
The short answer to this problem is that Thunderbird does not POST to the URL in the Action attribute of the HTML form tag. Even the newest version of Thunderbird (version 31.2.0) "ignores" the POST and requests the URL via GET.
The construction of the HTML form is properly done and other email clients I have tested work fine:
Microsoft Office 365 Outlook Web App
Google GMail
So, I guess I am doing it "right" but some email clients apparently don't support this (even my favorite which is Thunderbird).
I need to do dynamic link opening based on each of 3 cases. How do I write this into a link ?
Case 1: user is on desktop or Android. Send user to website link with
reference to content example.com/content/123
Case 2: user is on
iOS app is not installed. Send to App Download, post download open
content article that user tapped on
Case 3: user is on iOS app is
installed. Open app with activity link and link to that activity in
the app myapp://content/123
Any ideas how to write this into an HTML source that I can add to email? On click it will have to figure out what it wants to do.
Here is what the source looks like in mailchimp email template per content item:
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
Any help is greatly appreciated.
You are looking for the concept of deep linking. I can help you with 2 of your cases
First I'll explain how I would attempt to make this work. This sample will open the Facebook app and navigate to the Wikipedia page. You can try this out by opening this link from your Android or iOS device.
Instead of having the direct link in the email itself, I'd use one link that would then, on the server's side, determine the action to take.
In your email template, do this
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
This should then take the user to a script named 'my_server_script.php' (my example is PHP, but you can achieve this in any language).
In this script, you can then check the User Agent by using PHP's $_SERVER['HTTP_USER_AGENT']. This will give you something like Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3. Then by parsing this string, you can determine the user's OS and take an action based on that. Please do note that User Agent strings can be modified and is not always 100%, but it should be more than enough for your use.
Once you have determined the action to take, you could redirect the user to the app by sending them to the deeplink.
Here is PHP code I tested on Android earlier, this should open the Facebook app and take you to the Wikipedia page. As far as I know, it should work on iOS as well.
<?php
// Set App deeplink
$app_url = 'fb://profile/33138223345';
// Try to redirect the device to the URL
header('Location: ' . $app_url);
?>
I don't have a solution for detecting if the app is installed, but if you do find a solution for
that, you should be able to redirect them to the appropriate app store using the code below
<?php
// iTunes link
$app_install_link = 'https://itunes.apple.com/za/app/facebook/id284882215?mt=8';
// Then redirect the user to the app store location
header('Location: ' . $app_install_link);
?>
If you determine they should be sent to the desktop version, simply do
<?php
// Browser link
$link = 'https://example.com/content/123';
header('Location: ' . $link );
?>
This is personally how I would make this work since you won't have the capability in the email itself to check what device you are on and modify the link based on that.
You should however still be able to use the deeplink fb://profile/33138223345 by doing
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
and that should open the Facebook app on iOS and Android.
Hope this helped a bit!
I have to send an email to several hundred users. Each will have a link tailored to the recipient so I need to generate the emails in script/code - I'm no Notes developer so I can't do this in Notes; I'm using C# and I'm pulling the list out of a SQL database.
There are some constraints:
The site that the link points to uses Integrated Windows Authentication.
The sender wants the link to be a button, rather than text.
The vast majority of recipients are running Lotus Notes 7.
I've tried creating an HTML mail but have had problems:
If I use a form with a submit button and action that points to the link, Notes tries to use its internal browser which fails (because the site uses Integrated Windows Authentication).
If I use an a href tag with an img tag in it, pointing to an image on a webserver, Notes refuses to display the image - i just get the red x box, even though the tags are valid if embedded in a web page.
Anyone know how I can do this?
I finally found a method that works: embedding the image in the email itself. I found the solution here. I'll include the critical stuff here, just in case.
There are three key components to the email: the plain text version, the html version and the image, all consructed as AlternateViews:
string imagePath = #"C:\Work\images\clickhere.jpg";
AlternateView imageView = new AlternateView(imagePath, MediaTypeNames.Image.Jpeg);
imageView.ContentId = "uniqueId";
imageView.TransferEncoding = TransferEncoding.Base64;
:
//loop to generate the url and send the emails containing
AlternateView plainTextView = AlternateView.CreateAlternateViewFromString(
BuildPlainTextMessage(url), null, "text/plain");
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
BuildHtmlMessage(url), null, "text/html");
//set up MailAddress objects called to and from
:
MailMessage mail = new MailMessage(from, to);
mail.Subject = "ACTION REQUIRED: Do this by then or else";
mail.AlternateViews.Add(plainTextView);
mail.AlternateViews.Add(htmlView);
mail.AlternateViews.Add(imageView);
//send mail using SmtpClient as normal
:
//endloop
BuildHtmlMessage(string) and BuildPlainTextMessage(string) just return strings containing the messages. BuildHtmlMessage includes this to display the image in a link to 'url':
sb.AppendLine("<div>");
sb.AppendFormat("<a href=\"{0}\" target=\"_blank\">", url);
sb.Append("<img alt=\"Click here button image\" hspace=0 src=\"cid:uniqueId\" ");
sb.Append("align=baseline border=0 >");
sb.Append("</a>");
sb.AppendLine("</div>");
Hope this is of use to someone else, sometime.
I imagine no matter what link you use (button, text), you're going to run into that same problem where the Notes client launches its internal browser. That's a preference on the Notes client, and it could be different on all machines.
I would first try a standard text link to see if it has the same behavior. Maybe if that does work for some reason, you at least can deliver a workaround.
Regarding the image issue - is the image coming from the server using Windows Authentication? Make sure the image is open to the public and doesn't require authentication to see it (test in Firefox, and if you don't get a password prompt, you're safe)
I hate to say it, but you might have to request users copy a URL from their email to a specific browser. At least you'd know that would work.
I agree with Ken on the preference for the internal browser. The image not displaying - showing a red x - might be a preference also. I don't recall if it was available in R7, but in R8 there is a preference to not show remote images automatically. It is a security feature. It could also be a proxy issue - if they would have to login to their internet proxy server to get to the internet, and your image is on the internet...
There is also this but it fires off a security warning to the user with my Notes config:
<input type='button'
onclick=document.location.href='http://server/path';
value='Click here'
id='buttonID' class='button'
xstyle='background-color:red;color:white;'/>