0

I'm developing a WAP site for J2ME and low end Symbian phones. When the site is opened on non WAP browsers such as Chrome or Safari, the raw WML code is displayed.

I wanted to know if there's a way in WML to check the browser or user agent on which the page is opened. The objective is to detect the browser and redirect to WML or HTML pages based on the result.

Sahil Khanna
  • 4,262
  • 8
  • 47
  • 72

1 Answers1

0

This can not be done with pure WML. You can use PHP + WML and check the browser agent with PHP code:

echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
yardie
  • 1,583
  • 1
  • 14
  • 29
  • I didn't use PHP but tried with JavaScript. On low end devices the JS did not execute and the browser gave the message "Unsupported content". I can't even capture this error as it is presented by the browser. Any suggestions please.. – Sahil Khanna Apr 22 '16 at 10:27
  • I would suggest using PHP with wml (if possible), as you experienced; not all browser support javascript. – yardie Apr 22 '16 at 12:08