Javascript iPhone和Android上出现的表单操作属性链接
我有一张表格。此表单中有一个输入区域。当用户选择输入时,根据他们使用的设备,他们会被带到三个位置之一。android-谷歌游戏商店,iphone-itunes商店,桌面-itunes网络浏览器。我能够检索iphone和桌面的状态,但是Android似乎无法处理带有action属性的表单标签。链接工作正常。不知道问题是什么。谢谢Javascript iPhone和Android上出现的表单操作属性链接,javascript,android,html,Javascript,Android,Html,我有一张表格。此表单中有一个输入区域。当用户选择输入时,根据他们使用的设备,他们会被带到三个位置之一。android-谷歌游戏商店,iphone-itunes商店,桌面-itunes网络浏览器。我能够检索iphone和桌面的状态,但是Android似乎无法处理带有action属性的表单标签。链接工作正常。不知道问题是什么。谢谢 <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name='viewport' content='initial-scale=1'>
</head>
<body>
<div class='main'>
<br/>
<br/>
<br/>
<form id="store-link" >
<input type='submit' value='Download'/>
</form>
<br/>
<br/>
<br/>
</div>
<div class='footer'>
<p>footer</p>
</div>
</body>
<script>
var a = document.getElementById('store-link');
if (navigator.userAgent.match(/Android/i)) {
a.action = 'https://play.google.com/store/apps/details?id=com.ksmobile.launcher';
}
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))){
a.action = 'itms://itunes.apple.com/us/app/peanuts-storygif-christmas/id1181016912?mt=8';
}
else {
a.action = 'https://itunes.apple.com/us/app/peanuts-storygif-christmas/id1181016912?mt=8';
}
</script>
</html>
页脚
var a=document.getElementById('store-link');
if(navigator.userAgent.match(/Android/i)){
a、 行动https://play.google.com/store/apps/details?id=com.ksmobile.launcher';
}
if((navigator.userAgent.match(/iPhone/i))| |(navigator.userAgent.match(/iPod/i))| |(navigator.userAgent.match(/iPad/i))){
a、 行动itms://itunes.apple.com/us/app/peanuts-storygif-christmas/id1181016912?mt=8';
}
否则{
a、 行动https://itunes.apple.com/us/app/peanuts-storygif-christmas/id1181016912?mt=8';
}
可能是因为在该模拟器/手机上,您选择了“始终使用Chrome/webbrowser”而不是“仅使用一次”,因此现在它会在浏览器中打开所有google play URL,而不是提示您使用play store或浏览器(或仅使用play store)
您可以在设置中清除这些首选项。可能是因为在该模拟器/手机上,您选择了“始终使用Chrome/webbrowser”而不是“仅使用一次”,因此现在它会在浏览器中打开所有google play URL,而不是提示您使用play store或浏览器(或仅使用play store) 您可以在“设置”中清除这些首选项