The ‘greater-than’ vs. ‘comment’ dilemna

The ‘greater-than’ vs. ‘comment’ dilemna

Question:
The ‘greater-than’ vs. ‘comment’ dilemna

Answer:
There is a trick in writing JavaScripts which all developers should learn as soon as possible. When putting a script in your HTML, you should comment out the code (using ). The comments will keep the code from actually being written on the web page, yet won’t stop the parser from loading the script. Here’s a peek at what this looks like:

1. <HMTL>2. <HEAD><TITLE>A comment test</TITLE>3. <SCRIPT LANGUAGE="JavaScript">4. <!-- This will hide the script from being displayed5. . . .6. // -->7. </SCRIPT>8. </HEAD>9. <BODY>. . . </BODY></HTML>

Obviously, the line numbers above are only used for reference and not part of the HTML.

  • In line 4 you’ll see that we begin a comment by using standard HTML notation: ‘‘. This will signal that the browser should end the logical comment block that was started on line 4. This type of HTML tag is specific to Netscape, because standard HTML dictates the use of ‘>‘ to end a comment block.
The fact that Netscape uses a proprietary tag to mark the end of a comment should not suprise anybody. They have an entire set of tags which they are trying to get the rest of the internet community to adopt as standards, but which will only work on their browser. So how does this affect us as JavaScript programmers?

When a non-Netscape browser is parsing the code, it will see the standard ‘‘ tag. This means you must be careful to not use greater than sign because you won’t even realize the problem exists until somebody else sees the page with a different browser!

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing