Jump to content

redirect to a mobile website


ajnl

Recommended Posts

  • 2 years later...

<script type="text/javascript">
var mobile_domain ="website.address.here";
// Set to false to not redirect on iPad.
var ipad = true;
// Set to false to not redirect on other tablets (Android , BlackBerry, WebOS tablets).
var other_tablets = true;
document.write(unescape("%3Cscript src='"+location.protocol+"//s3.amazonaws.com/me.static/js/me.redirect.min.js' type='text/javascript'%3E%3C/script%3E"));
</script>

Simple JS redirect, just in case anyone else needs help with it :)

Link to comment
Share on other sites

Nice share.. However it would probably be better to use a htaccess rewrite rule if possible because is faster and doesnt rely on JS which can be disabled on most browsers..

Link to comment
Share on other sites

Nice share.. However it would probably be better to use a htaccess rewrite rule if possible because is faster and doesnt rely on JS which can be disabled on most browsers..

 

how would you do it with htaccess? I'm not the webmaster for that organization anymore, but just out curiosity lol.

 

I used php back then.

Link to comment
Share on other sites

You can do it based on the detected device.. Search google for htaccess mobile browser detection :) on mobile right now >.<

 

Well you're no help ;). haha just messing. Thanks, i'll look it up some time

 

Try this http://m.fearless-assasins.com. this URL is what my android phone uses! hope this helps!

 

not looking for the FA mobile website. The question is if you are hosting a website (www.example.com) how do you have it redirect to the mobile website when some1 accesses it from an iphone or android. And how do you get it to redirect to the tablet website, when it is accessed with a tablet.

Link to comment
Share on other sites

  • Administrators

not looking for the FA mobile website. The question is if you are hosting a website (www.example.com) how do you have it redirect to the mobile website when some1 accesses it from an iphone or android. And how do you get it to redirect to the tablet website, when it is accessed with a tablet.

 

Try this: http://code.google.com/p/php-mobile-detect/

 

OR

 

function checkMobile()  {
 if (preg_match("/Mobile|Android|BlackBerry|iPhone|Windows Phone/", $_SERVER['HTTP_USER_AGENT'])) {
   header(Location: MOBILE SITE);
}

 

<?php checkMobile() ?>

 

Their are tons of way to do it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.