1
我有一個表單。在這種形式中有一個輸入區域。當用戶選擇輸入時,他們被帶到三個地方之一,取決於他們正在使用的設備。 android - google play store,iphone - itunes store,桌面 - itunes網頁瀏覽器。我能夠檢索iphone和桌面狀態,但Android似乎無法在具有操作屬性的表單標記上工作。鏈接工作正常。不知道問題是什麼。謝謝。表單在iPhone和Android上發生的動作屬性鏈接
<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>