We Recommend

ASP.NET 3.5 Unleashed ASP.NET 3.5 Unleashed
ASP.NET 3.5 Unleashed is the most comprehensive book available on the Microsoft ASP.NET 3.5 Framework, covering all aspects of the ASP.NET 3.5 Framework--no matter how advanced.


Posted By

neal_grosskopf on 06/24/08


Tagged

function validation ASP


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

neal_grosskopf
basicmagic


Make YouTube Embed HTML Validate


Published in: ASP 


URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=18

YouTube offers a method for users and developers to embed video on their web pages. Unfortunately the code that they use doesn't validate. Use this function to make YouTube's embed code validate.

  1. Function YouTubeCleanup(embed,link)
  2.  
  3. if len(replace(embed,"youtube","")) << len(embed) then
  4. url = "http://www.youtube.com/v/" & replace(link,"http://www.youtube.com/watch?v=","") & "&hl=en"
  5. embed = "<object type=""application/x-shockwave-flash"" data=""" & url & "&hl=en""><param name=""movie"" value=""" & url & """></object>"
  6. end if
  7. YouTubeCleanup = embed
  8.  
  9. End Function

Report this snippet 

You need to login to post a comment.