D
domtam
Hi there.
My goal is to add some script to my home page (which is NOT asp / aspx
page, and it is not hosted in IIS) so that any request from mobile
browser will be redirect to another page (a wap page which uses asp.net
mobile control page). How can I do that?
Originally, I planned to use Javascript to do it.
<script language="javascript">
var agt = navigator.userAgent.toLowerCase();
var is_mobile = ( (agt.indexOf("blacknerry") != -1)
|| (agt.indexOf("nokia") != -1)
|| (agt.indexOf("WebtV") != -1)
|| (agt.indexOf("windows ce") != -1)
|| (agt.indexOf("microsoft pocket internet explorer") != -1)
|| (agt.indexOf("up") != -1)
// more different mobile browser user agent here.
);
var mobile_url = "http://wap.mydomain.com";
if (is_mobile)
window.location = mobile_url;
</script>
It worked with Pocket PC IE, but it didn't work with BlackBerry browser
(emulator).
I suspect that it's because the blackberry browser doesn't understand
javascript. Is that true? If it is the case, it probably won't work for
other mobile browser too.
Is there a better solution to this problem?
Thanks
Dom
My goal is to add some script to my home page (which is NOT asp / aspx
page, and it is not hosted in IIS) so that any request from mobile
browser will be redirect to another page (a wap page which uses asp.net
mobile control page). How can I do that?
Originally, I planned to use Javascript to do it.
<script language="javascript">
var agt = navigator.userAgent.toLowerCase();
var is_mobile = ( (agt.indexOf("blacknerry") != -1)
|| (agt.indexOf("nokia") != -1)
|| (agt.indexOf("WebtV") != -1)
|| (agt.indexOf("windows ce") != -1)
|| (agt.indexOf("microsoft pocket internet explorer") != -1)
|| (agt.indexOf("up") != -1)
// more different mobile browser user agent here.
);
var mobile_url = "http://wap.mydomain.com";
if (is_mobile)
window.location = mobile_url;
</script>
It worked with Pocket PC IE, but it didn't work with BlackBerry browser
(emulator).
I suspect that it's because the blackberry browser doesn't understand
javascript. Is that true? If it is the case, it probably won't work for
other mobile browser too.
Is there a better solution to this problem?
Thanks
Dom