function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Walter De VosWalter De Vos 

HTML tags in Visualforce are escaped

Hi

When I create a new page like this:

<apex:page>
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>

The source of that page looks like this:

&lt;apex:page &gt;
&lt;!-- Begin Default Content REMOVE THIS --&gt;
&lt;h1&gt;Congratulations&lt;/h1&gt;
This is your new Page
&lt;!-- End Default Content REMOVE THIS --&gt;
&lt;/apex:page&gt;

Why is this , and how can I make it render html tags with < and > intact.

Thanks
 
SaranshSaransh
This is working fine for me. You can easily use HTML tags inside <apex:page> tag.
You can try in case you are getting problem using tags :
<apex:page contentType="text/html" >

 
Walter De VosWalter De Vos
Ok I tried:
<apex:page contentType="text/html" >
  <h1>Congratulations</h1>
  This is your new Page
</apex:page>

but I'm still getting :
 
&lt;apex:page contentType="text/html" &gt;
  &lt;h1&gt;Congratulations&lt;/h1&gt;
  This is your new Page
&lt;/apex:page&gt;

Using Chrome Versie 41.0.2272.89 m
Salesforce Development org 


 
Walter De VosWalter De Vos
It seemt to be connected to "view-source" in Chrome. The page runs fine and "inspect element" shows the html tags fine. Only when I ask the source, this conversion happens and apex tags aren't executed.
SaranshSaransh
I don't know why is it showing on view source like that.