HTML 5 Comment Syntax
I'm looking for a way to add comments to HTML 5, meaning text that is not executed but is there to help understand the programming. In CSS I see /* comment */ used for that purpose. In HTML, I see comments, but it's not clear how they are flagged as comments.
For example, I've seen <!-- comment-->, but that syntax also seems to be used for conditional statements that are executed, as in <!--[if gt IE 8]><!-->. That looks like it's written as a comment, but obviously it's meant to be executed. I think. I just want to be able to safely add comments to the HTML code, but I need help with the syntax. THanks!
Comments are ignored. Scripts inside comments won't execute.
IE Conditional Comments are hacks. They always begin with an IF statement which only IE browsers see.
<!--[if lt IE 9]>
Why did MS do this? To mitigate the fact that IE browsers are not standards compliant. Instead of fixing the problem like they should have done a decade ago, MS decided to make a window so developers could workaround the serious shortcomings in these inferior browsers. Nice, huh?
IE10 promises to be standards compliant thus won't need any hacks. Cross your fingers.
Nancy O.
Similar Messages
-
HTML Comments in a JSP Document
I am writing a JSP Document that has a number of comments. Some I want to be server-side such as version history and some I want to be client-side.
Using a JSP page this is easily achieved using JSP comments <%-- JSP comment for server-side --%> and HTML Comments<!-- HTML comment client-side -->.
Using XML syntax a number of things are apparent:
1. There is no XML equivalent of a JSP comment (this has been well doc'd for a long time).
2. In the Java EE tutorials the recommended alternative to a JSP coomment is a HTML comment.
3. Using HTML comments in a JSP document the web container omits these in the page output - and so they are server-side only just like a JSP comment.
Code Snippet:
<template xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="1.2">
<!-- this comment will not appear in the generated source on the client browser -->
</template>
<!-- JSP fragment for no caching policy -->
So, my question is how do I generate a client-side comment in a JSP Document?
Thanks
Edited by: DJT on Mar 3, 2008 4:28 AM
Edited by: DJT on Mar 3, 2008 4:30 AMI found this ....
http://www.javaworld.com/javaworld/jw-07-2003/jw-0725-morejsp.html
One significant disadvantage of JSP documents is that no XML-compliant version of JSP comments exists. A JSP document developer can use client-side (HTML-/XML-style) comments or embed Java comments in scriptlets, but there is no JSP document equivalent to <%-- -->. This is a disadvantage because the other two commenting styles JSP documents can use have their own drawbacks. You can see the client-side comments in the rendered page using the browser's View Source option. The Java comments in scriptlets require placing Java code directly in the JSP document.
So try to embed the HTML comment inside scriptlet tags...
<%
<!-- HTML comment here -->
%> -
Inserting HTML comments from the Insert menu
So I understand that the insert menu has been changed in CS6 and then again in CC (Dreamweaver 12.2).
http://helpx.adobe.com/dreamweaver/using/changes-insert-options-creative-cloud.html
I am using DW CC. I want to insert HTML comments quickly in a bunch of different locations in my page code. Is there a way to do that?
If this must now be done by hand I would like to know why. The reason for the changes is explained as removing support for deprecated elements, but HTML comments are not deprecated in HTML 5.
http://www.w3.org/html/wg/drafts/html/master/syntax.html#commentsThere is another option. Select the block of the code and choose the comment option as per your requirement. See image below.
-
Hey,
I have a question concerning the JSP specification and HTML comments (1.1 and 1.2):
Code like this:
<script language="JavaScript">
<!--
<%
int a;
if (true)
a = 2;
%>
-->
</script>
<html>
<body>
<b>
a = <%= a %>
</b>
</body>
</html>
prints print out:
a = 2
with Tomcat 4.0.x , but not with Orion 1.5.x. Orion ignores the scriptlet code within the HTML comment.
Both blame to be JSP compliant in that respect. The specification says (1.1 chapter: 2.3; 1.2 chapter: 2.5):
In order to generate comments that appear in the response output stream to the requesting
client, the HTML and XML comment syntax is used, as follows:
<!-- comments ... -->
These comments are treated as uninterpreted template text by the JSP container. If the
generated comment is to have dynamic data, this can be obtained through an expression
syntax, as in:
<!-- comments <%= expression %> more comments ... -->
Now, does this mean JSP scriptlets (<% scriptlet %>) in HTML comments are ignored or not?This is a known bug in the Orion server; using the Oracle Containers for J2EE, which is the Orion server under license, I often have to deal with the same problem.
Either don't remark out your JavaScript files, or place your HTML remarks inside JSP remarks so the Orion server can parse it correctly:
<script language="JavaScript">
<%="<!--"%>
<%
int a;
if (true)
a = 2;
%>
<%="-->"%>
</script> -
Html comment in JSP compiled and rendered in NW7.3?
Hi,
We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
Is this correct or is it a bug?
Thanks,
StefanHi,
We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
Is this correct or is it a bug?
Thanks,
Stefan -
HTML comments not showing up in snippets in RH9?
I want to be able to add some HTML comments sometimes when I enter content.
For example, let's say I want a pair of HTML comments like so, with a place for text between them.
<!-- begin info pulled from the v3 P & P manual -->
and
<!-- end info pulled from the v3 P & P manual -->
I created a snippet, entering the following using HTML view:
<!-- begin info pulled from the v3 P & P manual -->
<p>Copy the text in here.</p>
<!-- end info pulled from the v3 P & P manual -->
When I dragged the snippet onto the topic, though, the HTML comments (lines 1 and 3 in the example) were missing. That was the whole point of the snippet: To be able to copy in the HTML comment lines.
I can open the snippet in HTML view, copy the lines, and paste them into the HTML view of the topic, of course, but I'm going to be leaving this project after it's over and don't want to have my successor pulling his/her head out wondering how to get this to work.
Suggestions?No comment is going to appear in Design View, regardless of whether it is in a snippet, an ordinary topic or any page being edited in any HTML editor's design view. That's the whole point of comments, they are something that only appear in the HTML view.
Maybe you were hoping the content of the snippet appeared in topics rather than just the reference?
Anyway, I am sure Amebr's excellent alternative approach will work for you.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
JDev 10.1.3.3.0: How to include an HTML comment in a JSPX page
When adding an HTML comment to a JSPX file, it automatically gets stripped out before being rendered to the browser.
How do I write a comment to the browser for diagnostic purposes (to figure out where something gets rendered in the HTML).
Thanks,
JonathanTry enclosing the HTML code in a <f:verbatim> tag.
-
When you have the following code:
<style type="text/css">
<!--
.header {
font-weight: bold;
background: #979797;
-->
</style>
What does that mean? This header class will only take effect
in IE? Or, is does the <!-- and --> do something else?Considering the movement towards HTML 5 that day is even less
likely to
come though you can use a mime type of application/xml with
XHTM. IE won't
like it but you *could* do it. <g>
Cheryl D Wise
http://starttoweb.com
"David Powers" <[email protected]> wrote in message
news:fm0bl8$7tu$[email protected]..
> Gary White wrote:
>> I rarely include html comments in <style> or
<script>
>> blocks, just to be on the safe side.
>
> I never include them myself, but I think Dreamweaver
still does when it
> inserts a script or style block automatically. Given the
glacial pace of
> change with (X)HTML, I wonder if I'll ever live to see
the day when
> ordinary web pages are served as XML.
>
> --
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3"
(friends of ED)
> Author, "PHP Solutions" (friends of ED)
>
http://foundationphp.com/ -
We recently upgraded from RH5 to RH7 and I am running RH
version 7.00.145 on my machine.
After upgrading, we found there were problems with em dashes
and en dashes, in that they displayed as &emdash; or
&endash in our output. We corrected this with a search and
replace, replacing the erroneous code with RH's code (eg <symbol
name="Em Dash"><robohelp>—</robohelp>).
After this, however, we noticed that RH7 sometimes copied
HTML comments from within the header and inserted them along with
the code for the em dashes or en dashes. This produces the
appearance of an extra space in the output.
The only way we have found of fixing this is to move HTML
comments from the header to the bottom of the page, then manually
delete the extra comments around the en or em dash.
This problem does not happen with every page that has en
dashes or em dashes and there are no obvious differences between
pages that are affected and those that are not.
Has anyone else encountered similar problems? I would
appreciate any advice on why this problem is occurring and any tips
on how we can stop this.
Thanks in advance, TriciaYou need to install all the patches. There were many serious
bugs fixed in 7.01 and 7.02. There is also a 7.03 out now, which
wouldn't hurt to install either. I believe you'll need to install
all three patches in order. You can find information about the
patches and bugs on
Peter Grainge's site.
I don't think the projects you've opened with 7.00 will be
fixed automatically by these patches, but any new projects, or ones
you haven't yet upgraded won't show these issue. For the effected
projects, if you haven't done anything apart from upgrade them, you
could restart with backup copies, but that might not be a
possibility if you've made a lot of changes.
I'm sure Rick, Peter et al. will jump in with additional
info, but you can at least have a look at what Peter has already
put together. -
How to make the auto generated java script not to have any html comments.
Hello BEA Experts, As you know that auto generated javascript functions like getNetuiTagNames in Workshop are included with in the the HTML comment tags like <b><!--
--!></b> its another thing they should be generated correctly as follows <b><!--
//--!></b>, to hide it from browsers not supporting javascript.
My question is there any way to stop generation of the HTML comment tags and just genrate the javascript with in teh script elements..
Please let me know..
Thanks in advance..
-Bob F.Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
Please clarify? -
How to suppress the html comment at start of output
Hi,
Does anyone know how to suppress the html comment that ITS inserts at the beginning of the response content.
i.e.:
<!--
This page was created by the
SAP Internet Transaction Server (ITS, Version 6100.1030.61.1891, Build 610.611891, Virtual Server SY1, WGate-AGate Host aauwsd00, WGate-Instance SY1)
Template: znc_xworktime/99/xml.html -->
This appears to be causing havoc with the applet's XML parser...
org.jdom.input.JDOMParseException: Error on line 8: XML declaration may only begin entities.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:468)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
at com.alcatel.ontap.applets.timesheet.TimesheetTableLoader.run(TimesheetTableLoader.java:75)
Caused by: org.xml.sax.SAXParseException: XML declaration may only begin entities.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3364)
at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:1140)
at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1266)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:654)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
... 2 moreCheck out OSS Note No.747818
You can use the ~no_its_header parameter to deactivate the default
header that is generated. As soon as this parameter contains any value,
header generation is suppressed. In ITS 6.20, you can set the parameter
with the AdminTool. You will find the relevant switch under
Security-General.
If the ITS is integrated into the WebAS (SAP Netweaver 04 and higher),
you must maintain the parameter in the ICF service. Note that you have
to maintain the parameter individually for each service.
Regards
Raja -
HTML Comment : <!-- Comment -->
JSP Comment : <%-- --%>
1) What is the different between HTML Comment and JSP comment.
2) How the web container will treat these two comments??
Regards
DhineshHi,
JSP comments are used for documenting JSP code and are not visible client-side (using browser's View Source option) where as HTML comments are visible.
cheers,
k -
Removing HTML Comments from an entire website
Hi, I wonder if there is a simpler way to remove 'HTML Comments' from an entire website without having to use the regular expression ' <!-- [\w\W]*?--> ' using Find & Replace in DW 8? Many thanks, Simon
Thanks Murray, - I guess I was hoping for a 'button' in DW 8 that offered this function without writing a simple regular expression that works just fine. What laziness! My reasons for removing my HTML comments also puts me in a bad light!!! Best wishes, Simon
-
Consider the following html code where I open a textarea and include a comment tag within the textarea. Within the comment tag (which Firefox 4 should ignore) I've included a close textarea tag. Firefox 4 (unlike FF3 and IE) closes the textarea.
The following code is also available at
http://www.cems.uwe.ac.uk/caa/ffbug/index.html
We are about to start a textarea....<p>
<pre><nowiki><textarea rows='20' cols='40'>
Here is the textarea.
Inside these comment blocks I'll put a close textarea tag which Firefox should ignore but does not.
<p>
<!--
We are now inside comment blocks...
<br>
This code should be inside the text area.<br>
</textarea>
<br>
and so should this code be <b>inside</b> the text area (but is not in Firefox 4).
-->
</textarea>
<p></nowiki></pre>
This code should be outside the textbox.Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
http://forums.mozillazine.org/viewforum.php?f=25 <br />
You'll need to register and login to be able to post in that forum. -
Html comments problem in 2.2.1
Have recently updgraded to version 2.2.1 and in the process of verifying the differneces and problems.
have noticed the following:
have a page template which contains 2 page level item substitutions &PX_ITEM. and &PX_ITEM2. above and below a piece of html
the value of these items is either blank or <!-- and --> respectively thereby allowing the code to be commented out on the fly. This worked in previous version of HTMLDB in APEX 2.2.1 however the chevrons are being output as < and > respectively and so are not being recognised as comment tags.....
any ideas as to why this has changed and how to set it back to working the way it did in previous releases???Farhan,
If those two items are set to Display As "Hidden", try changing them to
"Display as Text (does not save state)".
More item types, including Hidden items have their contents escaped to remove HTML in version 2.2.
Maybe you are looking for
-
Graphic Card Upgrade for HP-Pavilion dv6t-7000
Hello. I have the HP Pavlilion dv6t-7000 with the NVIDIA GT650M 1GB grpahics card. Now because of my work, i need to extends my graphic card memory. So I want to ask if my laptop is possible to upgrade to GT650M 2GB card. My product number is A5F74AV
-
Ipod touch 4 not seen as a device on Itunes, doesn't connect to each other
This is an ongoing problem, I have been in touch with Apple three times and they can't fix it. Problem, my computer and the Ipod 4 don't see each other. I can't down load music or connect. I have tried connecting with two another computers with succe
-
How to import data from one instance to other
Hello all, I want to modify the data in one dev instance from production instace ,but in same table can any help me out with command how to retreive the data from other instance example: I want to change the email address of a person in per_all_peopl
-
Real-time photo resolution info?
I had been using Quark 8 for a few months and now am back to ID CS 4. While using Quark, I noticed that when you re-size a photo by dragging its frame, Quark will tell you in real time what the effective dpi is of the current size of the photo. In ID
-
Documents not printing correctly
We recently upgraded our marketing department from CS4 Design Standard to CS5.5 on to CS6 and now a printing problem has cropped up, starting in CS5.5. When printing a document with a lot on it most of the graphics are missing. The only way to get th