Database Journal: The Knowledge Center for Database Professionals
| |
Software Review: NetObjects' ScriptBuilder, Part 2
By Scott Clark
A Script inside saves time.
One such example is a small browser detection function that is included in the Script Library. You insert the code within your script by clicking on the Script Library icon on the toolbar, and selecting the code you wish to insert. Then you click "Insert" and the code is on your page. The function can then be used to write browser-specific code so that the page is displayed properly by each browser, i.e.
function DetermineCurrentBrowser() {
var current_browser = "";
var bwr = navigator.appName;
var ver = parseInt(navigator.appVersion, 10);
if ( bwr == "Netscape" && ver == 4 )
current_browser = "Netscape 4.0";
else if ( bwr == "Netscape" && ver == 3 )
current_browser = "Netscape 3.0";
else if ( bwr == "Netscape" && ver == 2 )
current_browser = "Netscape 2.0";
else if ( bwr == "Microsoft Internet Explorer"
&& ver == 3 )
current_browser = "MSIE 3.0";
else if ( bwr == "Microsoft Internet Explorer"
&& ver == 4 )
current_browser = "MSIE 4.0";
else current_browser = "Other";
return current_browser;
} // end DetermineCurrentBrowser
if ( current_browser == "Netscape4.0")
document.write('You are using Netscape Navigator 4.0');
Since ScriptBuilder allows me to insert my own snippets of code, I could potentially add the code directly below "end DetermineCurrentBrowser" to the Script Library. Another handy feature is the Script Inspector, which enables you to determine which browsers will support your page's features. The tool also features extensive Search and Replace functions, taking much of the pain out of script editing.
[Move on to the last part of the article]
Contact the WebDeveloper.com® staff
Last modified:
20
|
|
Refresh Daily
Join Editor-in-Chief David Fiedler
and find truth, justice, and a clue or two.
|