휴대 전화 사용자를 리디렉션하는 자바 스크립트 코드가 있습니다. 코드를 확인해 주셔서 감사합니다. 그물, 총 newb에서 가져 왔습니다. 스크립트의 품질에 관한 귀하의 의견을 소중히 여깁니다.휴대 전화 사용자를 리디렉션하는 자바 스크립트
모든 종류의 휴대 전화를 지원합니까?
function RedirectSmartphone(url) {
if (url && url.length > 0 && IsSmartphone())
window.location = url;
}
function IsSmartphone() {
if (DetectUagent("android")) return true;
else if (DetectUagent("iphone")) return true;
else if (DetectUagent("ipod")) return true;
else if (DetectUagent("symbian")) return true;
return false;
}
function DetectUagent(name) {
var uagent = navigator.userAgent.toLowerCase();
if (uagent.search(name) > -1)
return true;
else
return false;
}
RedirectSmartphone("http://mobile.version.com");
원하는 경우 http://detectmobilebrowser.com/에서 코드가 생성됩니다. 전에 코드를 사용했는데 꽤 잘 작동합니다. – dtanders
잘 모르겠습니다. 개인적으로 사용자 에이전트를 스니핑하는 대신 화면 해상도를 확인합니다. 그렇게하면 화면마다 올바른 페이지/스타일을 가질 수 있습니다. –
모든 종류의 휴대 전화를 지원합니까? ** 아니요 ** Blackberry, WebOS 및 Windows Phone 7은 무엇입니까? – Greg