website - Site redirects when loaded by mobile device -


i want user directed mobile implementation when tries load webpage using mobile device. there script can use iphone, android , maybe samsung? found scripts in internet cannot figure out 1 working , 1 not

if wanting javascript redirect, can examine user agent of browser , act accordingly. can prove inaccurate because user agents can modified (often times case). below example checks if device ipad , routes browser location. need find out user agents dealing iphone, android, or other device , implement logic. hope helps.

window.onload = page_onload;  function page_onload() {   if (navigator.useragent.match(/ipad/) != null) {      window.location = "http://[some mobile url]";   } } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -