GiantIsland Logo

ImageIsland Logo ImageIsland Website Software Screenshot

Try ImageIsland Professional 3.0! It's Website Photo Gallery Software for your Personal Website.

  • Cross-browser compatible product
  • Manage photos from your website!
  • Supports GIF, PNG, JPEG, and more
  • Creates thumbnails automatically
  • Upload 10 photos at a time
  • Secure login feature, plus user logins
  • Rotate/resize images in your browser
  • Share photos using web page galleries
  • 10 cool photo album templates
  • Drag-and-drop web server installation
  • No database to install ever!
  • Much, much more!

Or, view our  Live Demo IconOnline Live Demo.

JavaScript and CDATA

When using JavaScript, you main find that the CDATA concept works for you, too. Let's start at the beginning. When implementing the "script" element in the header of your web page, there are a few tricks you must be aware of in order to be both compliant with XHTML (and XML), as well as compliant with older web browsers.

In general, XML devices read anything with < and > as "legal nodes", and in the future, may not run JavaScript in some agents, with the newer XHTML and XML mime types assigned to a web page. XML parsers and agents built into the browsers, will also interpret script comments ("//") as content and anything inside script tags as content as well. So you can no longer use older script tag comments often used for older or non-javascript compliant agents in past development projects. An example of this out-dated format is shown below:

<script type="text/javascript">
alert('Your Javascript may not work...');

In the new XHTML recommendations, all tags, including the "script" tag are seen as XML nodes, and any content inside is interpreted as XML and parsed as such. We want the desktop browsers to run the JavaScript inside this tag, yet be compliant with the XML/XHTML parsers modern browsers. Its important to note that anything inside the script tag must not be parsed and interpreted as XML by the browser's parser. In addition, though most modern browsers interpret the "script" block as script, many xml agents and older browsers may read the code as XML and so print out this data, or interpret it as XML content.

To prevent that, yet support modern desktop browsers, you must tell these alternate parsers your JavaScript is "CDATA". CDATA tells the parser to ignore everything inside the CDATA section. This allows the content in the JavaScript block to be safely ignored by the XML parser and interpreted by the browser's DOM as script. To do this, we place a special "commented" CDATA wrapper inside this script element. This allows the XML parser to validate the script node, yet allow modern agents the ability to interpret the node as script and run it without generating scripting errors. Note below that we have also commented out the CDATA content block itself for those older agents that do not interpret CDATA as such in the script block, but which still understand html comments. This new comment prevents a wide range of users from seeing the CDATA code, while newer agents apply the correct CDATA code, validate as XML, and run the script block:

<script type="text/javascript">
alert('Your Javascript is working!');

Looking for great standards-based Website Products for your website? Get GiantIsland Web Products!