ghacks Technology News

How To Display Valid Markup Code In Websites

w3cThere are two difficulties or problems that Internet users encounter when they want to paste code into forms to display these on the Internet. The first problem that can be encountered is that the website will interpret part or all of the code instead of displaying it. A basic example would be to display the html code needed to make text linkable on a website. These codes are interpreted by most forms automatically if the user just pastes the code into the form. The second problem that can arise is that the website will not validate because of the way it has been pasted into the form. Displaying the & char will for example return an error when validating the code. This can lead to all kinds of troubles including broken RSS feeds (read: The XML Feed Cannot Be Displayed).

Displaying valid markup code in websites, forums, blogs and any other page is not difficulty. The only thing that needs to be done to achieve this is to convert all entities before pasting the code. This can be done manually or by using a script like that offered at Spacefem.

All that needs to be done is to paste the code into the form and click on the Make Code button at the bottom. To display the following code on a website

<a href="http://www.ghacks.net/">Ghacks</a>

one would have to paste the following code into the form on the website where the code should be displayed

&lt;a href=&quot;http://www.ghacks.net/&quot;&gt;Ghacks&lt;/a&gt;

html entities converter

This is actually the easiest way to ensure that the website will not interpret the code and that the code will be valid markup code.

Enjoyed the article?: Then sign-up for our free newsletter or RSS feed to kick off your day with the latest technology news and tips, or share the article with your friends and contacts on Facebook or Twitter.

Related Articles:

Simures, Display Websites In Different Resolutions
Firefox Copy Code
QR Code Generator
Display websites next to each other in Firefox
Display Cached RSS Feed In Your Website



About the Author:Martin Brinkmann is a journalist from Germany who founded Ghacks Technology News Back in 2005. He is passionate about all things tech and knows the Internet and computers like the back of his hand. You can follow Martin on Facebook or Twitter.

Author: , Thursday May 7, 2009 -
Tags:, , , , , , ,


Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

Subscribe without commenting

© 2005-2012 Ghacks.net. All Rights Reserved. Privacy Policy - About Us