472,127 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

ASP Detection Code for Multiple Web Pages

Currently, only the index page is .asp and has code in the header to detect mobile devices. So if someone goes to our website on a mobile phone they are redirected to the mobile site. All the other pages are .html. If someone uses google search and happens to find a page deeper within our site, and they are on a mobile device, then they get the regular website page. We need them to get the mobile equivalent of that searched page, since they are on mobile.

Is there a way to use a single .asp page to detect mobile devices for all our web pages? Or does each web page need to be .asp and have the redirect code in the header as our homepage does?

One reason for wanting only one asp page is so that if there are changes to the detection code, it only has to be done in one place... not on every single webpage.

We are using IIS. We have the mobile site under a folder called mobile separate from the regular website... so pointing to it is easier if need be.

If more specifics are needed... let me know.
Oct 31 '07 #1
1 1487
markrawlingson
346 Expert 100+
One reason for wanting only one asp page is so that if there are changes to the detection code, it only has to be done in one place... not on every single webpage.
That's why functions and subroutines were invented, but unfortunately not many people know how to effectively harness their power...

Personally, I have a functions include which contains a long list of functions and subroutines which perform often rudimentary tasks - but can be called in any webpage very easily - and if i ever need to update any of the functions I CAN do this is one place, rather than editing every page in my website(s). If I need to add a function, I can also do this in one place - and the function will be accessible by all my webpages without having to go into each one and add the function/code.

Anyway, one possible solution to your problem is to have a seperate ASP page in the back-end that only contains the code for checking the mobile phone, etc and redirecting. You could use AJAX on all of your .html pages, which would basically consist of javascript (which will, of course, run in an html file) - will call your ASP page in the background, and based on the result you can redirect the user.

Sincerely,
Mark
Oct 31 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

60 posts views Thread by Fotios | last post: by
8 posts views Thread by __jakal__ | last post: by
6 posts views Thread by Frank Esser | last post: by
5 posts views Thread by Dave H | last post: by
7 posts views Thread by Csaba Gabor | last post: by
10 posts views Thread by Conrad Lender | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.