问题
I have to open my iOS app whenever user open a link of my app in browser. I have already used a like myApp://
but i want to open my app even when user open an http link a from browser. Just like pinterest. Pinterest opens app even if i open a regular http link like this http://www.pinterest.com/pseudoamber/
and using URL scheme as well like this pinterest://www.pinterest.com/pseudoamber/
. My app is opening on myApp://www.myapp.com
now i want to open my app when user open an http link like this http://www.myapp.com
Anybody please help
回答1:
Here is an example using jQuery:
$(document).ready(function() {
var user_agent_header = navigator.userAgent;
if(user_agent_header.indexOf('iPhone')!=-1 || user_agent_header.indexOf('iPod')!=-1 || user_agent_header.indexOf('iPad')!=-1){
setTimeout(function() { window.location="myApp://www.myapp.com";}, 25);
}
});
来源:https://stackoverflow.com/questions/23077411/how-to-open-ios-app-from-browser