How to load a flash file in any broswer?
We are trying to load a flash file in a browser from local machine its loading only in Internet Explorer (IE) but not in o开发者_运维技巧ther browsers. Please suggest me some solution.
Hey mate, you should try SWFObject.
You can download it from here: http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip&can=2&q=
The documentation is here: http://code.google.com/p/swfobject/wiki/documentation
You should put your code here otherwise we can't really help you :)
Rob
here is a basic example for the SWFObject:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Embedding FlowPlayer using SWFObject</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/swfobject.js"></script>
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<!-- SWFObject downloads and documentation: http://code.google.com/p/swfobject/wiki/documentation -->
<script type="text/javascript">
function embedFlash()
{
var flashvarsObj = {
};
//flashvars.config = config;
var paramsObj = {
allowScriptAccess: "sameDomain",
allowFullScreen: "true"
};
var attributesObj = {};
swfobject.embedSWF("swf/test.swf", "flowplayer_container", "300", "200", "10", "swf/expressInstall.swf", flashvarsObj, paramsObj, attributesObj);
}
</script>
</head>
<body>
<div id="flash_container" style="background-color:#ff0000; width:300px; height:200px;">Your SWF file will be placed here.</div>
<script type="text/javascript">embedFlash();</script>
</body>
</html>
You can download the swfobject.js file and the expressinstall.swf file from the link I sent you previously.
Good luck, Rob
Judging from the unformatted code block you posted in the other answer, your HTML is missing an <embed>
tag inside the <object>
tag. You need both to correctly start the plugin in all browsers. You can read about this here.
You might still want to check out swfobject, as suggested in the other answer.
精彩评论