mailto launches the default mail client outlook but then current tab closes - javascript

I am using IE8.
var ClientContactsTable = document.getElementById("clientContacts");
var TableRow = ClientContactsTable.insertRow(1);
var Email=TableRow.insertCell(0);
Email.setAttribute("className","CellValueWrap");
Email.innerHTML='My Name'==''?" ":"<a class='ReportLink' target='_blank' href='mailto:"+'me#gmail.com'+"'>"+"My Name"+"</a>";
alert(Email.innerHTML);
When I am clicking on My Name - it launches Outlook, asks for permission (whether you want to launch the outlook client or not), once I do Allow it launches Outlook and then the tab which was running my app displays the address as me#gmail.com with blank content. then I have to do a back to go to my app page.
this is surely disappointing for my users.
This issue does not happen in Firefox. How to avoid it?
I tried both target='_blank' as well as _self but both causing same problem

Related

google.script.host.close is not a function / self-closing popup

Trying to figure out an annoyance. I have 2 separate web apps in Google Apps Script (one runs as the user, one runs as the script owner. They don't actually talk to each other - other than script 1 opens a popup with a pre-formatted URL with the correct parameters etc.)
Web App 1 opens Web App 2 in a popup. Web App 2 should ideally be able to close itself, but I can't seem to figure out how. I've tried open(location, '_self').close(); as well as google.script.host.close();
My current setup is below:
Web App 1 Client-Side (No issues)
function common_token_ready(instructionsObject){
var url = instructionsObject.pickerURL;
window.open(url,"_blank","height=720,width=1280");
}
Web App 2 Client Side (Works other than being unable to close itself)
function save_success_handler(response){
document.getElementById("main").innerHTML = "Please close this window to continue.";
google.script.host.close();
}
I get a TypeError google.script.host.close is not a function
Any ideas?

Prevent a URL/webpage from opening in application

I have an application which supports all urls having xyz as domain.
So now if I sent my users a message or a mail containing the link of the above domain like xyz.com/abc or maybe xyz.com, for mobile IOS users the link opens in browser but for mobile android users there is a pop up which asks the user to choose whether they want to open the link in my app or the browser.
I have an issue with what the android is doing. I don't want that pop up for some particular links, I want that link to open in browser instead of the application. Is there a way I can achieve it by setting some headers in the response or maybe setting some meta tags in the html.
Thanks in advance for the help!!
You can get you domain host from the URL:
Uri url = Uri.parse("www.xyz.com/lol");
String host = url.getHost();
if (host.equals("xyz.com")) {
openInAppMethod();
} else {
openInBrowserMethod();
}
And then choose the way to open your url.

When using facebook deep URL to open app, both app and webpage open together

I am using this as my link in webpage.
<a class="btn btn-lg btn-orange" role="button" onclick="myFunction()">like me</a>
And this as my script.
function myFunction() {
$(function(){
window.location = "fb://profile/1456471431314551";
setTimeout(function () { window.location = "https://www.facebook.com/angelsatwork2015"; }, 25);
})
}
When I open in mobile both the browser fb page and the fb app open. Please help so that if the app opens it does not redirect to fb browser page.
Also when I use this code on desktop two different browser pages open.
This is most likely the expected behavior for that code.
What you're doing when that button is clicked is immediately opening the URL fb://profile/1456471431314551. Assuming this is iOS, this causes the system to show an alert asking if you want the app to launch. However, as of iOS 9.2, this alert is non-blocking, which means other code continues to execute in the background. This is why, 25 milliseconds later, you're opening the URL https://www.facebook.com/angelsatwork2015 as a regular webpage.
Unfortunately there is no good solution to this in the iOS 9.2+ world (thanks, Apple...). What we do at Branch.io is a combination of Universal Links (which launch the app when it is installed...most of the time) and redirections like the one you're trying for edge cases where Universal Links don't work. We set tracking cookies based on device UUID to know when we are safe to attempt launching the app, but in reality, this often means we have to redirect to the App Store if we aren't sure, just to avoid the behavior you're encountering.

javascript mailto not working in chrome mobile browser

mailto via javascript not working in mobile chrome browser
window.location.href = "mailto:linto.cet#gmail.com?subject=subject&body=body"
is not working in mobile google chrome browser
actual source
Chrome on Android is blocking the redirects to apps that are not made via a user gesture.
So via javascript it's not possible to redirect the user to the mail app since Chrome 40, only if you put it for example in a button href, that will work when user clicks the button.
You can read more in chromium forum
If you inspect the Chrome console you will a warning, something like: Navigation is blocked: mailto:?...
I am posting an answer as this is possible.
Create a hidden from view / temporary link element and simulate the click.
var linkElement = document.createElement('a');
linkElement.style.visibility = 'hidden';
linkElement.style.position = 'absolute';
linkElement.href = 'mailto:linto.cet#gmail.com?subject=subject&body=body';
document.body.appendChild(linkElement);
and later when you want to trigger and open the mail client:
linkElement.click();
On my site, when people click on what they believe to be mailto links (same restrictions apply on tel: links, by the way), I first send a GA event, and then use window.location to initiate the mailto. While Chrome will give me the warning via the dev console, it still processes the tel/mailto request, and the window still pops up.

Send email navigating future location Waze API

I wanted to ask whether there is a possibility that I'll email a link that will be pressed on through the Smartphones, the waze will open with a specific address. I saw the page http://www.waze.co.il/dev/documentation/ browser and tried to access the address of Smartphones with this and he did not respond to it (opens a Google search - Android).
Is there such a way? (Basically emulate sharing app gives place).
You can open the browser with this url (from Weze API):
With JavaScript:
document.querySelector('span').onclick = function() {
location.href = 'waze://?q=<address search term>';
}
<span>Navigate</span>
With html:
Navigate
I'll email a link that will be pressed on through the Smartphones
You can just send an email with the link to waze://?q=<address search term>
You can not, at the moment.
That API is for in-app use only (Android & iOS).

Categories