0

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...

3
  • This could help you. It is another post on Stack Overflow. The question is quite similar to yours. Commented 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. Commented Aug 29, 2013 at 13:23
  • Also see this question. Commented Aug 29, 2013 at 13:26

2 Answers 2

0

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............

Sign up to request clarification or add additional context in comments.

Comments

0

For that you have to identify that User has which device>??

For that Try below code...

if (android.os.Build.VERSION.SDK_INT > 10 && android.os.Build.VERSION.SDK_INT <18 ) { //do stuff } else { //do stuff } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.