08-13-2003, 10:00 AM
|
Pontificator
Join Date: Aug 2006
Posts: 1,177
|
|
Making Pocket PC Friendly Web Sites
Builder.com has an interesting article on how to make a web site Pocket PC friendly, or mobile device friendly for that matter! The article Pocket PC Web Site Development Tips brings up aspects such as detecting the browser, screen size limitations, scripting and XML support, bandwidth, security, and offline browsing. Pocket PC Thoughts works very nicely on Pocket PCs (nowadays!)! Over at businessanyplace.net we have used browser detection a long time to present the site nicely to mobile devices. If you are interested, you can read on to see some of the code making it possible:
A variable (IsPPC) is set at the beginning of the page by checking the user agent:
Code:
<%<br />' Device Indicators<br />Public IsPPC, IsMME, IsThinClient<br />IsPPC = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE") > 0)<br />IsMME = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MME") > 0)<br />IsThinClient = (IsPPC Or IsMME)<br />%>
<br /><br />In the rest of the page, we can use the variable to determine programmatically how specific parts of the page should be formatted. For example, this code segment is located at the very end of a page:<br /><br />
Code:
<% If Not IsPPC Then %><br /><table cellspacing="0" cellpadding="0" width="758" border="0"><br /> <tr><br /> <td align="middle" colSpan="3"><img src="images/1x1empty.gif" width="100%" height="2"><br><img <br /> src="images/1x1black.gif" width="758" height="1" vspace="2"></td><br /> </tr><br /> <tr><br /> <td valign="top"><% ' left footer %></td><br /> <td valign="top"><% ' center footer %></td><br /> <td valign="top" align="right">�2001 Andreas Sj�str�m & Christian Forsberg<br><br /> <% If False Then %><a href="mailto:[email protected]">Contact us</a><% End If %></td><br /> </tr><br /></table><br /><% Else %><br /><table cellspacing="0" cellpadding="0" width="100%" border="0"><br /> <tr><td><img src="images/1x1black.gif" width="100%" height="1" vspace="2"></td></tr><br /></table><br /><font size="1">�2001 Andreas Sj�str�m & Christian Forsberg<br></font><br /><% End If %>
|
|
|
|
|
08-13-2003, 04:25 PM
|
|
08-13-2003, 04:42 PM
|
Editor Emeritus
Join Date: Aug 2006
Posts: 15,171
|
|
Thanks for the update.
--janak
|
|
|
|
|
08-13-2003, 08:18 PM
|
Thinker
Join Date: Jul 2003
Posts: 443
|
|
Doing this with PHP would be something like..
<?php
// Page formatted for Windows CE
$ce = 'Some part of that should be changed for mobile viewing';
// Page formatted for normal viewing
$notce = 'some normal stuff';
$browser = strpos($_SERVER['HTTP_USER_AGENT'], "Windows CE");
if ($browser !== FALSE)
echo $ce;
else
echo $notce;
?>
|
|
|
|
|
08-14-2003, 01:43 AM
|
Swami
Join Date: May 2004
Posts: 4,396
|
|
PHP Bug
Quote:
Originally Posted by qmrq
$browser = strpos($_SERVER['HTTP_USER_AGENT'], "Windows CE");
if ($browswer !== FALSE)
|
Which won't work with that typo. 0X In the IF statement, change "browswer" to "browser".
Steve
|
|
|
|
|
08-14-2003, 09:03 PM
|
Thinker
Join Date: Jul 2003
Posts: 443
|
|
Typo?! What typo? I don't see any errors Steve.. you must be going crazy.
|
|
|
|
|
08-14-2003, 09:55 PM
|
Moderator
Join Date: Aug 2006
Posts: 6,878
|
|
Quote:
Originally Posted by qmrq
Typo?! What typo? I don't see any errors Steve.. you must be going crazy.
|
Well...
You can fix it in your post, but it's still in his quote... :wink: :lol:
Good try though!!!
Steve
__________________
"My eyes are rolling back in my head so far I can see my grey matter bubbling and frothing from reading this thread....bleh." JD
|
|
|
|
|
08-16-2003, 03:59 AM
|
Swami
Join Date: May 2004
Posts: 4,396
|
|
Edit Marks
Quote:
Originally Posted by qmrq
Typo?! What typo? I don't see any errors Steve.. you must be going crazy.
|
Pay no attention to the "Last edited" line in the post.... ops:
Steve
|
|
|
|
|
08-16-2003, 04:01 AM
|
Thinker
Join Date: Jul 2003
Posts: 443
|
|
Exactly. Pay no attention to that at all. ops:
|
|
|
|
|
08-16-2003, 04:02 AM
|
Swami
Join Date: May 2004
Posts: 4,396
|
|
Quotes
Quote:
Originally Posted by Steven Cedrone
You can fix it in your post, but it's still in his quote... :wink: :lol:
Pony99CA is the coolest guy here!
|
Of course, quotations can always be altered -- not that anybody would do such a thing. :rotfl:
Steve
|
|
|
|
|
|
|
|