289 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 4
  • Weekly Top Seller
+3 more
dany_j
says

Hello! need little help
i need script that detect user device than ridirect to apropriate domain.
example:
if PC than go to www.domain.com
if mobile than go to www.mob.domain.com or www.domain.com/mob
web is html but I asume index need to be php which rederect
i found this one
and if there is some better way please tell me

1845 posts LoveThemes
  • Elite Author
  • Author Level 7
  • Exclusive Author
  • Trendsetter
+10 more
LoveThemes
says

You can use JS too. Just set the screen width less than or equal to and the redirect location.

<script type="text/javascript">
<!--
if (screen.width <= 320) {
document.location = "mobile.html";
}
//-->
</script>
289 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 4
  • Weekly Top Seller
+3 more
dany_j
says

thanks! this looks realy simple! :)

289 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 4
  • Weekly Top Seller
+3 more
dany_j
says

but seams that is not working if its just that code

254 posts
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 6
  • Collector Level 1
+4 more
PabloFierro
says

You can use JS too. Just set the screen width less than or equal to and the redirect location.
<script type="text/javascript">
<!--
if (screen.width <= 320) {
document.location = "mobile.html";
}
//-->
</script>

This is perhaps one of the sloppiest piece of code i’ve seen.

use this instead: http://code.google.com/p/php-mobile-detect/ there’s always a way around this method, but it works perfectly.

1845 posts LoveThemes
  • Elite Author
  • Author Level 7
  • Exclusive Author
  • Trendsetter
+10 more
LoveThemes
says


You can use JS too. Just set the screen width less than or equal to and the redirect location.
<script type="text/javascript">
<!--
if (screen.width <= 320) {
document.location = "mobile.html";
}
//-->
</script>

This is perhaps one of the sloppiest piece of code i’ve seen.

use this instead: http://code.google.com/p/php-mobile-detect/ there’s always a way around this method, but it works perfectly.

Well go tell Chris Coyier of CSS Tricks, it’s his code. I use my own PHP script.

289 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 4
  • Weekly Top Seller
+3 more
dany_j
says


You can use JS too. Just set the screen width less than or equal to and the redirect location.
<script type="text/javascript">
<!--
if (screen.width <= 320) {
document.location = "mobile.html";
}
//-->
</script>

This is perhaps one of the sloppiest piece of code i’ve seen.

use this instead: http://code.google.com/p/php-mobile-detect/ there’s always a way around this method, but it works perfectly.

Thanks!
I will test that option to

by
by
by
by
by
by