Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YouTube iframe embeds throw JavaScript errors in Internet Explorer 8

It seems that simple YouTube iframe embeds throw JavaScript errors when viewed in Internet Explorer 8. Hopefully someone can find what I'm doing wrong - unless this is a new bug?

How to reproduce:

  1. Open up Internet Explorer 8 and hit F12 to bring up the developer tools
  2. Switch to the "Console" tab to watch the JavaScript console
  3. Visit http://ehough.com/ie8-youtube.html, which is an iframe embed copied directly from youtube.com, and view the JavaScript errors

Errors:

SCRIPT5007: Unable to get value of the property 'getActivated': object is null or undefined 
ie8-youtube.html, line 28 character 128

SCRIPT5020: Expected ')' in regular expression 
html5player-vflR_cX32.js, line 675 character 708

SCRIPT438: Object doesn't support property or method 'SetReturnValue' 
www-embed-vflqDUnF8.js, line 66 character 56

SCRIPT438: Object doesn't support property or method 'SetReturnValue' 
uVlr4eYkNjY, line 1 character 1

Anyone have any insight into this?

like image 846
3hough Avatar asked Apr 15 '13 19:04

3hough


1 Answers

IE8 and below doesn't support much modern stuff. But I'm pretty sure it works on IE9 and above though. I tested on IE10 (I don't have IE8 on my computer anymore), and it works just fine.

On the Youtube embed feature, There used to be a radio-button that says "use old embed code." That's the old-style embed code that uses Flash Player instead of Iframe.

However, Youtube did away with this option in mid-2014.

There's still a way to get the old-style embed code. The snippet below shows a generic old-style embed code.

<object width="560" height="315"><param name="movie" 
value="http://www.youtube.com/v/ [your Youtube video URL here] ?version=3&hl=en_US"></param><param
name="allowFullScreen" value="true"></param><param 
name="allowscriptaccess" value="always"></param><embed 
src="http://www.youtube.com/v/ [your Youtube video URL here] ?version=3&hl=en_US" 
type="application/x-shockwave-flash" width="560" height="315" 
allowscriptaccess="always" 
allowfullscreen="true"></embed></object>

Do you see the text "[your Youtube video URL here]"? Replace that placeholder with the random stuff that you see at the end of Youtube video URLs. An example is shown below.

https://youtube.com/watch?v=NUjbKaUcxeA

To embed the video URL above, you should replace the "[your Youtube video URL here]" with "NUjbKaUcxeA."

If you want it to work on IE8, and perhaps even IE7, you should use the old-style embed code. The old-style embed code also works on modern browsers, too. 

like image 70
clickbait Avatar answered Nov 02 '22 23:11

clickbait