I have created an iPad application.
I want to launch it from safari. With URL Schema, it's done successfully.
From my application, I want to send a link. Which on click should open my app.
The mail which I have sent contains matter in the following way
CLICK HERE TO LAUNCH APP
Which is an anchor tag whose href = "MyApp://someString".
But when I send this as mail, on iPad configured mail, link is working fine but in browsers it's not working. Then I came to know that Yahoo, Gmail will deactivate links other than starting with http://
Now, I want to open my app with URL schema MyApp://
with HTML Onload similar to opening iTunes in our PC when itunes.apple is opened
With windows.open('MyApp://')
, in the onload()
function also, my app is not launching.
How to do that? How to launch my app when html is loading?
I have created an iPad application.
I want to launch it from safari. With URL Schema, it's done successfully.
From my application, I want to send a link. Which on click should open my app.
The mail which I have sent contains matter in the following way
CLICK HERE TO LAUNCH APP
Which is an anchor tag whose href = "MyApp://someString".
But when I send this as mail, on iPad configured mail, link is working fine but in browsers it's not working. Then I came to know that Yahoo, Gmail will deactivate links other than starting with http://
Now, I want to open my app with URL schema MyApp://
with HTML Onload similar to opening iTunes in our PC when itunes.apple. is opened
With windows.open('MyApp://')
, in the onload()
function also, my app is not launching.
How to do that? How to launch my app when html is loading?
Share Improve this question edited Jun 25, 2012 at 16:20 Bharath asked Jun 24, 2012 at 18:43 BharathBharath 3,0316 gold badges33 silver badges66 bronze badges 2-
You seem to have two questions here. 1. Links to open your app don’t work in Yahoo mail and GMail. 2. You can’t open your app from
window.onload
. You should ask them separately. – Paul D. Waite Commented Jun 25, 2012 at 16:28 -
1
“With
windows.open('MyApp://')
, in theonload()
function also, my app is not launching.” — Have you triedwindow.open('MyApp://')
, i.e. without thes
on the end ofwindow
? – Paul D. Waite Commented Jun 25, 2012 at 16:28
2 Answers
Reset to default 4Make a PHP page like this:
<?php
header("Location: MyApp://somestring;")(
?>
<html>
<head>
<meta http-equiv="Refresh" content="0; MyApp://somestring" />
<title>Opening App...</title>
<script>
function openApp() {
window.location.href = "MyApp://somestring";
}
</script>
</head>
<body onload="openApp();">
<a href="MyApp://somestring">Click here if app doesn't open...</a>
</body>
</html>
I doubt any online email client would let you run javascript in the email. It would be extremely insecure. If they refuse to handle any other URL schema than HTTP, it is probably because of the same security concerns.
I would work around the problem by having a link like
<a href="http://mydomain./open-app?schema=MyApp">CLICK HERE TO LAUNCH APP</a>
Then the page on your server would just print out
<script>
window.location.href="<?= $_GET['schema'] ?>://";
</script>
(Example in PHP)
Just make sure to scrub the schema variable before you print it!
You could use a regex to make sure it only has a-z, or something like that. Otherwise you get the same security problems Yahoo and Gmail are avoiding.