Sunday, May 10, 2009

Hiding Script

Hiding Script

When hiding script markup within a document, you may have to address what to do when a browser doesn’t support scripting. Traditionally when a browser encounters an element it doesn’t support it simply skips it and prints out the content within the element as plain text. A non-JavaScript-aware browser encountering an example such as;

Literally would print alert ("I am a script"); rather than running the script first. In order to avoid this undesirable situation, you should attempt to hide the script code from older browsers using comments, in fashion similar to the technique for hiding style sheets. An example of commenting on JavaScript is shown here;

Notice how the HTML comment starts the exclusion of JavaScript, but // as comments and does not attempt to run -- > as command.

Like other elements that reference technologies beyond basic markup, the script element supports a special element to deal with browsers that don’t execute a script. The
tag is used to enclose alternative text and markup for browsers that don’t interpret a script. Furthermore, users can turn off support for a scripting language in their browsers. The content renders onscreen, as shown below, if the user has turned off scripting support or is using a browser that doesn’t understand JavaScript.

Note; it is possibale to turn off JavaScript in browser rather easily by setting your preferences. This browser modification is performed by users primarily for security reasons, because there are many privacy exploits related to JavaScript usage.

Enter your email address:

Delivered by FeedBurner

My other blog;
1. Across this bridge
2.Struggling parents
4. When life become a book
5. Read Between the Lines
6. 7. The Sleeping Turtle Art Gallery

8. Marketing Myself

Add to Technorati Favorites

Subscribe in "Struggling Parents

No comments: