• home
  • forum
  • my
  • kt
  • download
  • Using Valid Youtube Embed Code

    Author: 2009-03-10 16:43:16 From:

    Tens of thousands of people use YouTube’s embed code to post their videos on their website or blog. Many people don’t know, however, that this code violates the official web standards or web page coding rules that all website designers and coders are supposed to follow. These rules exist so that a web page will work in an browser from Microsoft’s Internet Explorer, to Mozilla’s Firefox, to Apple’s Safari. You might be ask what can I do to correct this, and I have a solution for you. The standard youtube embed code looks like this:

    view plaincopy to clipboardprint?
    1.   
    2. <object width="425" height="344">  
    3. <param name="movie" value="http://www.youtube.com/v/u29x_488jG4&amp;amp;amp;amp;hl=en&amp;amp;amp;amp;fs=1"></param>  
    4. <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>  
    5. <embed src="http://www.youtube.com/v/u29x_488jG4&amp;amp;amp;amp;hl=en&amp;amp;amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"  
    6. width="425" height="344"></embed></object>  

    To correct the problem you can use the following code. Simply change the width and height values to your desired video size, and change “u29x_488jG4″ to the Youtube video id found on the end of the Youtube URL (ex. http://www.youtube.com/watch?v=u29x_488jG4).

    view plaincopy to clipboardprint?
    1.   
    2. <object type="application/x-shockwave-flash" style="width:635px; height:360px;"  
    3.  data="http://www.youtube.com/v/u29x_488jG4">  
    4.  <param name="movie" value="http://www.youtube.com/v/u29x_488jG4" /></object>   

    Happy validation!

    discuss this topic to forum

    relation tutorial

    No information

    Category

      Accessibility (12)
      Basics (20)
      Content (12)
      eCommerce (11)
      Miscellaneous (14)
      Site Optimization (15)
      Templates (7)

    New

    Hot