Make YouTube Embed HTML Validate


/ Published in: ASP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.