Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploadify in ie9 getting js error : SCRIPT5007: Object expected

I am trying to bind uploadify on div.
When I clicked on upload button it show me error like SCRIPT5007: Object expected.

For demo check below link which produced error on dragging of div in ie9

head

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.js"></script>
<script type="text/javascript" src="http://www.uploadify.com/wp-content/themes/uploadify/js/jquery.uploadify.min.js"></script>

body

<div class="container" id="container">
    <div id="uploadify-item"></div>
    This container is not draggable in IE9 but it works in Chrome and FF. Why not?
</div>

js

$('#uploadify-item').uploadify({
    'swf'      : 'http://www.uploadify.com/uploadify/uploadify.swf',
    'uploader' : 'http://www.uploadify.com/uploadify/uploadify.php'
});
$("#container").draggable();

Refer : http://jsfiddle.net/axzdR/19/

like image 639
sandeep Avatar asked Apr 22 '13 10:04

sandeep


3 Answers

IE9 seems to have a bug with SWFUpload embeds, whereby if you try to call "getAttribute / removeAttribute / setAttribute" on the element, an "object expected" error is raised. And I found that the cleanUp() function in the swfupload.js remove all the js functions including "getAttribute / removeAttribute / setAttribute" from the object DOM in IE9.

To fix this issue

In SWFUpload.prototype.cleanUp

Change:

if (typeof (movieElement[key]) === "function")

To:

if (typeof (movieElement[key]) === "function" && key[0] <= 'Z') // Remove only Flash functions (starts with capital letters). 

Patched version of uploadify is kept at this location

http://www.dariowiz.com/scripts/jquery.uploadify3.1Fixed.js

Regards.

like image 68
eHussain Avatar answered Nov 19 '22 00:11

eHussain


Try using lates jQuery (container is draggable in IE9, and "Object expected" error disapears)

 <script type="text/javascript"
 src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
 <script type="text/javascript"
 src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>

Make sure you have installed Flash player for IE (it is separate install) It can be downloaded from here http://get.adobe.com/flashplayer/otherversions/

But even Unloadify demos is not working in my IE9 (I can click like a minute in Select files button with no result and suddenly with no reason it starts to work and opens select files dialog)

like image 27
VitaliyG Avatar answered Nov 19 '22 00:11

VitaliyG


You find the finally solution for this problem here >>> https://groups.google.com/forum/?fromgroups=#!topic/swfupload/57ySk2JoLbE

like image 1
Davide Avatar answered Nov 19 '22 00:11

Davide