Spitfire6
asked on
swfobject is undefined error only in IE Internet Explorer
Happy New year to all!
I am trying to set up swfobject.js and getting an error in Internet Explorer only, although I have only tested otherwise in Firefox.
The attached code is from the swfobject documentation. All files are in the same folder.
swobject.js, expressinstall.swf, and KingReport.swf are all present in the folder with the html page being called by the browser.
When the page is rendered the error generated is " error line 8: 'swfobject' is undefined".
After the error message is cleared the page processes and the flash content is shown.
TIA!
I am trying to set up swfobject.js and getting an error in Internet Explorer only, although I have only tested otherwise in Firefox.
The attached code is from the swfobject documentation. All files are in the same folder.
swobject.js, expressinstall.swf, and KingReport.swf are all present in the folder with the html page being called by the browser.
When the page is rendered the error generated is " error line 8: 'swfobject' is undefined".
After the error message is cleared the page processes and the flash content is shown.
TIA!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0", "expressinstall.swf");
</script>
</head>
<body>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="1100" id="myFlashContent">
<param name="movie" value="KingReport.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="KingReport.swf" width="800" height="1100" id="myFlashContent">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
ASKER
Thanks for the reply fsze88,
I gave your code a try and am getting "error line 21: object required".
I see where you set the var msieRegex at line 4, but I don't understand what you are setting it to.
Tnx,
Mike
I gave your code a try and am getting "error line 21: object required".
I see where you set the var msieRegex at line 4, but I don't understand what you are setting it to.
Tnx,
Mike
it is for screen adjustment. not need for your case.
http://www.kennam.com/test/swfobject2.html
in your case, try to use
window.onload = function(){
swfobject.registerObject(" myFlashCon tent", "9.0.0", "expressinstall.swf");
}
should okey
http://www.kennam.com/test/swfobject2.html
in your case, try to use
window.onload = function(){
swfobject.registerObject("
}
should okey
<script type="text/javascript" src="/js/swfobject/swfobject.js"></script>
<script type="text/javascript">
var movieWidth, movieHeight;
var flashvars = {};
var params = {};
var attributes = {};
var params = {
allowFullScreen: "true",
allowScriptAccess: "always",
wmode: "transparent",
menu: "true",
scale: "exactfit",
base: "/video/source/"
};
movieWidth = 800;
movieHeight = 600;
window.onload = function(){
swfobject.embedSWF("/video/source/tissuepaper1.swf", "myContent", new String(movieWidth), new String(movieHeight), "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}
</script>
<div id="myContent">
</div>
ASKER
Modified your code slightly, as below.
All files are in the same folder as the html file being retreived.
Still get "Error Line 21 -swfobject is undefined"
All files are in the same folder as the html file being retreived.
Still get "Error Line 21 -swfobject is undefined"
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var movieWidth, movieHeight;
var flashvars = {};
var params = {};
var attributes = {};
var params = {
allowFullScreen: "true",
allowScriptAccess: "always",
wmode: "transparent",
menu: "true",
scale: "exactfit",
base: "/video/source/"
};
movieWidth = 800;
movieHeight = 1100;
window.onload = function(){
swfobject.embedSWF("KingReport.swf", "myContent", new String(movieWidth), new String(movieHeight), "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}
</script>
<div id="myContent">
</div>
is it works on ff or ie?
1) clear your browser (ff or ie) cache
2) append './' on front of each file path e.g. <script type="text/javascript" src="./swfobject.js"></scr ipt>
what browser issue come from ? (ff or ie)?
1) clear your browser (ff or ie) cache
2) append './' on front of each file path e.g. <script type="text/javascript" src="./swfobject.js"></scr
what browser issue come from ? (ff or ie)?
ASKER
Thanks for staying with this fsze88!
Originally, with my code at the top of this thread, It was working in FF but not IE. Your latest code is not working in either browser.
I have added ./ ahead of all files as suggested. No difference in IE - "Error line 21: swf object is undefined".
I do not have FF set to render error messages. FF just shows a blank page.
Originally, with my code at the top of this thread, It was working in FF but not IE. Your latest code is not working in either browser.
I have added ./ ahead of all files as suggested. No difference in IE - "Error line 21: swf object is undefined".
I do not have FF set to render error messages. FF just shows a blank page.
Spitfire6,
did you tried example on http://www.kennam.com/test/swfobj.html?
it is works on my computers, if doesn't work on yours, this may a problem cause from your browser
as you said there an error "Error line 21: swf object is undefined", but that flash is shown up after that error.
This should cause of wrong path or missed of swfobject.js file
That flash was shown up because of you are using <object> tag, doesn't matter of swfobject.js object.
the easiest way to test swfobject there? please have a try at code attachment.
if still swfobject is undefined, please check the file swfobject.js and path of it
did you tried example on http://www.kennam.com/test/swfobj.html?
it is works on my computers, if doesn't work on yours, this may a problem cause from your browser
as you said there an error "Error line 21: swf object is undefined", but that flash is shown up after that error.
This should cause of wrong path or missed of swfobject.js file
That flash was shown up because of you are using <object> tag, doesn't matter of swfobject.js object.
the easiest way to test swfobject there? please have a try at code attachment.
if still swfobject is undefined, please check the file swfobject.js and path of it
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
window.onload = function(){alert(swfobject);}
</script>
ASKER
Well this is very strange!
Your code above results in the same error: "swfobject is undefined". This is both in IE and FF. I am sure that the error has been present in FF all along but I did not check the FF error console. FF just bypassed the error and processed the rest of the page.
I have verified that swfobject.js is present in the correct locations (I currently have a copy in the site root and in two different sub-folders).
I can hit swfobject.js directly using the url (http://www.xxxxxxxxx.com/swfobject.js). When doing so I get the file info and print out of the script in my browser window. So I know the file is there.
I have tested using another computer. Same results.
????
Your code above results in the same error: "swfobject is undefined". This is both in IE and FF. I am sure that the error has been present in FF all along but I did not check the FF error console. FF just bypassed the error and processed the rest of the page.
I have verified that swfobject.js is present in the correct locations (I currently have a copy in the site root and in two different sub-folders).
I can hit swfobject.js directly using the url (http://www.xxxxxxxxx.com/swfobject.js). When doing so I get the file info and print out of the script in my browser window. So I know the file is there.
I have tested using another computer. Same results.
????
Please try goto http://www.kennam.com/test/swfobj.html
and also what is your ff or version
and also what is your ff or version
ASKER
Hello,
That link works fine. Nice big printer.
MY FF is version 3.0.16. IE is 6.0.29
That link works fine. Nice big printer.
MY FF is version 3.0.16. IE is 6.0.29
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks fsze88! That was the problem.
http://www.kennam.com/test/swfobj.html
works on ie,ff,safari,opera.....
Open in new window