|
January 27, 2000 Hiding New Features Tips: January 2000
Yehuda Shiran, Ph.D.
|
|
When a new JavaScript version is released, new features are introduced with it. When using these features, you have to hide them from older versions of JavaScript. The cumbersome way is to remember which browser versions were released with the new JavaScript version, and to hide the new features from older versions of these browsers. It is much simpler just to specify the new JavaScript version in the <SCRIPT> tag. Only JavaScript engines matching this version will interpret the code. Older versions of JavaScript engines will just ignore this tag, and will not interpret the JavaScript section. The following JavaScript code will be processed only by JavaScript engines of 1.3 and up:
You should see a Demo button here: If you don't see the button, your browser does not support JavaScript 1.3. The following code will be exercised only when JavaScript 1.4 comes along:
You should see a Demo button here when JavaScript 1.4 is out: Many features have been introduced in JavaScript 1.3. Learn more about them in Column 25, JavaScript 1.3 Overview, Part I, and Column 26, JavaScript 1.3 Overview, Part II.
People who read this tip also read these tips: Look for similar tips by subject: |