please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 18
Compatibility Techniques
Next
 

18.4 Compatibility Through CGI Scripts

When your web application includes the use of CGI scripts, another approach to all forms of JavaScript compatibility is to use a CGI script on your web server to generate all the JavaScript code used in your application. Then, this script can inspect the User-Agent field of the HTTP request header. This allows it to determine exactly what browser the user is running and generate customized JavaScript code that is known to work correctly on that browser. And if the CGI script detects that the user's browser does not support JavaScript, it can generate web pages that do not require JavaScript at all. The only drawback to this approach is that the CGI script cannot detect when a user has disabled JavaScript support in their browser.

Using a CGI script is also an ideal way to handle the SRC attribute of the <SCRIPT> tag. If the CGI script detects a browser that supports this attribute, it can trivially generate a web page that simply contains a reference to its JavaScript code. For other browsers, it can include that JavaScript code literally into the web page.

The Navigator.userAgent property contains the string that a browser sends as its User-Agent HTTP header. See the reference page for this property for more information. Note that writing CGI scripts is well beyond the scope of this book. For more information on doing so, see CGI Programming on the World Wide Web by Shishir Gundavaram, published by O'Reilly & Associates.


Previous Home Next
Compatibility with JavaScript 1.0 Browsers Book Index LiveConnect: JavaScript and Java

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/ch18_04.htm, 4KB, , updated: 2019/10/14 15:00, local time: 2024/12/23 05:51,
TOP NEW HELP FIND: 
3.133.133.251:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/techref/language/java/script/definitive/ch18_04.htm"> [Chapter 18] 18.4 Compatibility Through CGI Scripts</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .