Building a website based on a report i had to do, one key element was the use of mobile devices, ive been trying for a good couple of hours now and im still unable todo it for some reason, it doesnt need to be perfect (for example opera mobile etc doesnt need to be supported, just iphone/ipad and Android stock).
All i need todo is use javascript (or an alternative method if someone knows a way?) to detect the browser and if its one of the mobile ones then redirect to the mobilesite.htm. It seems everthing i do is ignored via my O2x on the stock browser, looking at websites which show how todo this it works fine but as soon as i try and implement it I cant get it working!. Now it maybe that im a bit tired after working but was just wondering if someone could point me in the right direction?
the main way i tried was:
<script type="text/javascript"> <![CDATA[
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
window.open('mobilesite.htm')
}
]]></script>
(also tried with document.location = "mobilesite.htm"; )
Am i just being an idiot here?