Fred Stevens-Smith
Fred Stevens-Smith

Reputation: 468

'Object expected' error from IE8 using YouTube API

Experiencing problems in IE8 with some javascript used to display YouTube videos using the Data API.

The error I'm getting is 'Object Expected', stemming from the second code line.

// <![CDATA[
var baseUrl = 'http://www.youtube.com/';
var swfUrl = constructUrl(baseUrl);

// allowScriptAccess must be set to allow the Javascript from one
// domain to access the swf on the youtube domain
var params = { allowScriptAccess: "always", bgcolor: "#cccccc" };

// This sets the ID of the DOM object or embed tag to 'myytplayer'.
// You can use this ID to access the swf and call the player's API
var atts = { id: "myytplayer" };
var flashvars = {};
swfobject.embedSWF(swfUrl, "ytapiplayer", "220", "125", "9", null,
  flashvars, params, atts);
//]]>

Has anyone come across this error, and do you have any tested solutions?

Upvotes: 1

Views: 689

Answers (1)

Marc B
Marc B

Reputation: 360912

IE will spit out the "object expected" error on a lot of things, including undefined functions. Most likely within the context of this function, you haven't included the library that defines constructURL().

Upvotes: 1

Related Questions