Getting jQuery Media Plugin to work in IE9
Instructions for getting the jQuery Media Plugin (jquery.media.js) to work in Internet Explorer 9 (IE9)
The jQuery Media Plugin from Malsup.com is an excellent utility for easily inserting embedded media into a website whilst keeping the code W3C standards-compliant. It works by unobtrusively converting standard markup into rich media content. I have used it for several years and it’s excellent.
Whilst the jQuery Media Plugin works seamlessly in Firefox, Chrome, Safari and Internet Explorer 8, previous versions of this code don’t work in Internet Explorer 9 except when viewed in quirks mode.
This is very easy to fix, and requires the substitution of two lines of code within jquery.media.js.
Foe the first change, you will need to replace this:
else if ($.browser.msie) {
with this:
else if (($.browser.msie) && ($.browser.version < 9)){
Foe the second change, you will need to replace this:
($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
with this:
(($.browser.msie && $.browser.version < 9 )|| player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
Effective changes seem to have been incorporated into the base JavaScript code on the Github and Malsup download sites, so an update of the script on your website is preferable to amending old code.
Comments
3 responses to “Getting jQuery Media Plugin to work in IE9”
THanks, worked a treat!
I have also made the above changes in jquery media file, but they are not effective enough.
Still throwing an error:
SCRIPT438: Object doesn’t support property or method ‘getElementByTagName’
jquery-1.7.1.min.js, line 16 character 59007
Please help!
Worked like a chime, thanks very much!