0
我似乎无法检测到用户代理。我的网址没有正确加载iframe。检测手机VS桌面和URL未被捕获
<iframe id="link" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
function convert() {
if (navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/) ||
navigator.userAgent.match(/Windows Phone/i) ||
navigator.userAgent.match(/ZuneWP7/i)
) {
var url4 = "http://news.ycombinator.com";
}
else {
var url4 = "lol.png";
}
document.getElementById("link").src=url4;
convert();
}
小提琴 - http://jsfiddle.net/DnRH3/
帮助!
你在内部使用'convert()'吗? –
我需要转换为加载 –