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
Mandy08Mandy08 

Can I use already developed html in my visual force page?

Hello -

I'm just getting started trying to create a very basic public website for my customers.

I have EE and know this is possible. After I created my site I need to assign my visual force

home page. Can I simply copy and paste already existing HTML page into a visual force

page without having to use excessive amounts of apex coding?

 

Any help or comments appreciated.

 

Amanda

Best Answer chosen by Admin (Salesforce Developers) 
RyanGuestRyanGuest

You can pretty much copy and paste HTML code into Visualforce.

 

A couple of quick gotchas:

 

- You'll need to put your HTML code inside <apex:page> tags.

 

Example:

 

<apex:page showHeader="false" standardStylesheets="false">

<html>

.....

</html>

</apex:page>

 

- When you save your page, you may see some warning about not enclosing all tags properly. You'll want to fix those.

 

Example:

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif">
</html>
</apex:page>

will need to become:

 

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif"></img>
</html>
</apex:page>

 

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif"></img>
</html>
</apex:page>

 

 

- The default cache time is 10 minutes, if you are using basic HTML and don't have anything dynamic, I would suggest increasing this by adding <apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800"> to your page header. This will cache the page for 3 hours at a time (will make it go A LOT faster)

All Answers

RyanGuestRyanGuest

You can pretty much copy and paste HTML code into Visualforce.

 

A couple of quick gotchas:

 

- You'll need to put your HTML code inside <apex:page> tags.

 

Example:

 

<apex:page showHeader="false" standardStylesheets="false">

<html>

.....

</html>

</apex:page>

 

- When you save your page, you may see some warning about not enclosing all tags properly. You'll want to fix those.

 

Example:

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif">
</html>
</apex:page>

will need to become:

 

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif"></img>
</html>
</apex:page>

 

 

<apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800">
<html>
<img src="s.gif"></img>
</html>
</apex:page>

 

 

- The default cache time is 10 minutes, if you are using basic HTML and don't have anything dynamic, I would suggest increasing this by adding <apex:page showHeader="false" standardStylesheets="false" cache="true" expires="10800"> to your page header. This will cache the page for 3 hours at a time (will make it go A LOT faster)

This was selected as the best answer
Mandy08Mandy08

Thanks so much, I was wondering about those warnings...

I really appreciate it.

 

Amanda