View Full Version : Java script help

08-05-2006, 05:59 PM
I have a site that I am creating pages that adapt to mobile devices. I am using a script for the regular pages that works like this:
<script language="Javascript"><!--
if (screen.width <= 400) {
document.location = "mobile/showArticle.asp";

Some of the pages have news stories that come from a database and typically the regular page would load something like this:

What I want to do since the main page uses the "http://www.mysite.com/news/showarticle.asp?ArticleID=4162" is to call the mobile page as shown above but it will do me no good unless I can cann ArticleID 4162.

Is there possibly a way to pass the id long somehow in the java script so it will show the mobile page and that ID?

08-05-2006, 06:24 PM
if (screen.width <= 400)
window.location.replace("mobile/showArticle.asp" + window.location.search);You shouldn't really be using Javascript for this, though.

08-05-2006, 06:57 PM
What would be the best way to do this?

08-05-2006, 07:07 PM
I'm not sure, but I know that some mobile devices probably wouldn't have JavaScript enabled.

08-05-2006, 08:07 PM
Server-side scripting -- check the User-Agent: and/or Accept: headers.

08-05-2006, 09:08 PM
Can you give me a little more info on where I can find some help on doing this?

08-05-2006, 09:40 PM

08-05-2006, 10:33 PM
I am using ASP on a Windows 2003 server. Is there any way to do that in ASP?

08-05-2006, 10:40 PM
Almost certainly, but I've no idea what it might be.