开发者

'Object expected' error from IE8 using YouTube API

开发者 https://www.devze.com 2023-03-09 12:34 出处:网络
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.

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);
开发者_C百科//]]>

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


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消