Help please! I need a code for redirecting both mobile and tablet users (all of them) to a different URL. The thing is that i have a flash base web site for desktop users and html 5 for mobile and tablet users so i need a code that will determinate if the user is using mobile(or tablet) and send him to different URL. I've found some jscript that determinates this by checking width of a screen (if (screen.width <= 1024)) but i think that very soon tablets will get bigger screen than 1024 (that is today's biggest standard tablet),so it won't bee usfull anymore .If i put a bigger number than 1024,it will be the same dimension as desktop/laptop screen...
- This could help you. It is another post on Stack Overflow. The question is quite similar to yours.ClaireG– ClaireG2013-08-29 13:14:32 +00:00Commented Aug 29, 2013 at 13:14
- Love to know what you're going to do about Microsoft Surface users. What you really mean is either (a) you want to redirect small screens to a different site, or (b) you want to redirect touchscreen devices to a different site. There's no good reason to pick out tablets and smartphones just because they're tablets and smartphones.Blazemonger– Blazemonger2013-08-29 13:23:55 +00:00Commented Aug 29, 2013 at 13:23
- Also see this question.Blazemonger– Blazemonger2013-08-29 13:26:42 +00:00Commented Aug 29, 2013 at 13:26
Add a comment |
2 Answers
I think if you develope Your website as a responsive site then your problem will be automatically solve.........
OR
Get device width using following code and apply your URL
DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int wwidth = displaymetrics.widthPixels; hope this will help you............