Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to recognize PDA

Status
Not open for further replies.

Vadim

Programmer
Feb 5, 2002
75
0
0
US
Is it possible for javascript to recognize if page running on PDA.
 

No. It is not possible to specifically test for running on a PDA. You can, however, test whether the user is running on one of the many PDA Operating systems, or using one of the many PDA browsers by detecting the OS and user agent strings:

Code:
alert('User agent string: ' + navigator.userAgent + '\nRunning on OS: ' + navigator.platform);

Windows returns "Win32" for the OS string. I have no idea what any of the many PDA OSes return. You'll have to test this yourself (or use Google to search for something like "PDA navigator.platform", etc)

Hope this helps,
Dan


The answers you get are only as good as the information you give!

 
To identify a specific PDA you would need to go to their website to see how they identify themselves as a user agent e.g.
However, since PDAs do not directly support framesets, you could use this as a generic approach:

Code:
<head><title>My Site</title></head>
<frameset rows="100%,*">
<frame src="nonpda.htm" scrolling="yes" />
<noframes><body>
<a href="pda.htm">PDA Version</a>
</noframes></body></frameset></html>

However, having said that, for any application that contains navigation, a frameset can be ideal.

For example, try this link with a regular browser and then with a PDA.

Clive
 

since PDAs do not directly support framesets

I have no idea what browsers are available for what PDA OSes, but surely this would be dependant on the browser being used, and nothing at all to do with the actual PDA?

Dan


The answers you get are only as good as the information you give!

 
I decided to use a size of screen as indicator because PDA use IE, so it is no other way to recognize it.
But, unfortunately, I found that it not work same as desktop. For instance it not let me show anything i add to body by javascript function on load.


 

For instance it not let me show anything i add to body by javascript function on load.

Now that will depend on what onload event you are using.

IE for Win CE does not support the onload event for the body element. It does, however, support the onload event for the window element (as long as you are running IE v4+). Try using that and see how you go.

Hope this helps,
Dan



The answers you get are only as good as the information you give!

 
Is there other script language that they support?
Or is it possible to upgrade PDA or it's browser to use javascript?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top