移动版时是否可以更改 link 的 href?

Is it possible to change href of a link when mobile version?

我想在移动版中更改 href 目标。

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    document.getElementById("myAnchor").href = "mobile-url";   //change url
    document.getElementById("myAnchor").target = "_blank";     //change target
}

您可以参考this找到"the best way to detect a mobile device in jQuery"