Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validate HTML using Javascript 1

Status
Not open for further replies.

zkent

IS-IT--Management
Apr 19, 2006
12
US
I have an XSLT that converts RSS to a neat and readable HTML document. The resulting HTML document uses javascript to do some fancy tricks. My HTML is table-free HTML using a CSS style sheet to display elements. My problem is that some of the RSS feeds display HTML in their content and their HTML is sometimes bad. Their bad HTML breaks my pretty HTML.

I need to know if there is a way to properly contain bad HTML so it won't affect mine or to test their HTML for errors before I try to display it.

I know Google Reader does something like this because the feeds that break my reader dont break Google. If I look at the Google source code, the offending elements are left out. How are they detecting and trapping that?
 
That won't work. The RSS content is contained in the RSS feed and not from a URL. I can't use an iframe without a src URL. Interesting thought though.
 
I can't use an iframe without a src URL

Yes you can... you can dynamically write content into it using JS (even if you have to load a dummy blank file into it first, although I'm sure you don't).

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
(even if you have to load a dummy blank file into it first, although I'm sure you don't)

If you're developing on a system that uses a security certificate (https) then you will need to use a blank html file. Otherwise attempting to utilize this frame will result in warnings on your page regarding your iframe containing non-secure content.

I had to deal with this about 2 years ago when implementing an iframe shim for a modal div on our production server that uses a security certificate. Initially importing a blank html file into the frame got rid of the security warning.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Ok this idea is working. Now i just have to deal with the iframe height issue. Each iframe should have a different height depending on the HTML injected there. I can't have scrollbars either. Any suggestions?
 
Thanks for the star, Dan [thumbsup2]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top