简体   繁体   English

WML脚本中的UserAgent检测

[英]UserAgent detection in WML Script

I'm developing a WAP site for J2ME and low end Symbian phones. 我正在为J2ME和低端Symbian手机开发WAP网站。 When the site is opened on non WAP browsers such as Chrome or Safari, the raw WML code is displayed. 在非WAP浏览器(例如Chrome或Safari)上打开网站时,将显示原始WML代码。

I wanted to know if there's a way in WML to check the browser or user agent on which the page is opened. 我想知道WML中是否可以检查打开页面的浏览器或用户代理。 The objective is to detect the browser and redirect to WML or HTML pages based on the result. 目的是检测浏览器并根据结果重定向到WML或HTML页面。

This can not be done with pure WML. 使用纯WML无法做到这一点。 You can use PHP + WML and check the browser agent with PHP code: 您可以使用PHP + WML并使用PHP代码检查浏览器代理:

echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM