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/
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.
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)
You find the finally solution for this problem here >>> https://groups.google.com/forum/?fromgroups=#!topic/swfupload/57ySk2JoLbE
It appears there is a problem in the sources of uploadify that conflicts with jquery UI in IE 9. Specifically in the swfupload utility. In order to fix it you need to do a little hack which appears to have detailed steps here: http://www.uploadify.com/forum/#/discussion/comment/19212
Sorry I can't validate this without setting up a whole test environment. Not something that can just be put in a JSFiddle. Good luck, let me know if you succeed.
Related
I am having trouble getting TurnJS working, i am loading all the images dynamically and i get all the images displayed at first, then after a few seconds once the page has loaded, the first and second image are displayed, the rest hidden, the image moves on hover but the whole flipbook isn't working and its not changing pages (unlike when i tried getting this to work on the basic version, although it wasn't perfect i had the pages turning), i think i may be loading the jquery in the wrong order (See below):
$this->template->styles['/assets/css/magazine.css'] = 'screen';
$this->template->styles['/assets/css/jquery.ui.css'] = 'screen';
$this->template->styles['/assets/css/jquery.ui.html4.css'] = 'screen';
$this->template->jscripts[]='assets/libraries/modernizr.2.5.3.min.js';
$this->template->jscripts[]='assets/libraries/jgestures.min.js';
$this->template->jscripts[]='assets/libraries/jquery-ui-1.8.20.custom.min.js';
$this->template->jscripts[]='assets/libraries/jquery.mousewheel.min.js';
$this->template->jscripts[]='assets/scripts/turn.js';
$this->template->jscripts[]='assets/scripts/turn.min.js';
$this->template->jscripts[]='assets/scripts/turn.html4.js';
$this->template->jscripts[]='assets/scripts/turn.html4.min.js';
$this->template->jscripts[]='assets/scripts/hash.js';
$this->template->jscripts[]='assets/scripts/zoom.js';
$this->template->jscripts[]='assets/scripts/zoom.min.js';
$this->template->jscripts[]='assets/scripts/magazine.js';
Jquery is already loaded so i don't need to load it again here just any extra libraries/scripts i need. The following errors i am getting in firebug are:
TypeError: $(...).turn is not a function
TypeError: Argument 1 of Node.insertBefore does not implement interface Node.
Use of getPreventDefault() is deprecated. Use defaultPrevented instead.
TypeError: book.turn is not a function
I have added my code here just so you can see what i have done, any help/guidance would be appreciated!
This is what i am aiming for here
If i look under scripts in firebug, it shows me the following order:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='/apps/assets/libraries/jquery-1.6.2.min.js'>\x3C/script>")</script>
<script type="text/javascript" src="/apps/assets/libraries/jquery-ui-1.8.12.custom.min.js"></script>
...and then all my scripts follow, which shows its loading jquery first?
In firefox 19 and firebug 1.X I encountered a strange bug when trying //#sourceurl.
Basically I'm dynamically adding script tag through dom manipulation as you can see in the sample below. This does not work.
Maybe it's a limitation of ff but I find it odd that it works in chrome and not in ff.
Can you confirm this and do you have any bypass to this bug?
Ps: I don't want to use global eval() as it crash in ie when using document.write
<html>
<head>
<script type="text/javascript">
var count=0;
function addNewScriptToHead()
{
var newScriptElem;
var newScriptText;
newScriptElem = document.createElement('script');
newScriptElem.setAttribute('type', 'text/javascript');
newScriptElem.setAttribute('id', '' + count);
newScriptElem.text= 'console.log("Yay !");//# sourceURL=root/test'+count++ +'.js';
document.body.appendChild(newScriptElem);
};
</script>
</head>
<body>
<button onclick="addNewScriptToHead()">add script</button><br><br>
</body>
</html>
Experimentation has lead me to believe the following:
As of version 20.0, FF still does not support //# sourceURL directly in its inbuilt web console.
//# sourceURL does work with the Firebug addon in FF, but not completely as expected/hoped.
A. It only works for eval. It doesn't work at all for appended
script nodes like in the original question.
B. Errors will have a line number and the URL, and you can click
the error to see the line of code. However, console.log does not
seem to be affected and shows no line number or URL.
Testing this feature from within FF's web console is not advised. I got different results than testing directly in HTML at least some of the time.
Consider the following HTML:
<!DOCTYPE html>
<html>
<body>
Test page
<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//cdn.zopim.com/?pTR0FiicfJ4aMcmuHI9HfVAB4uzKeFIT';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
<!--End of Zopim Live Chat Script-->
<script type="text/javascript" async="">
window.addEventListener('load', function() {
var b = document.getElementsByTagName("body")[0];
var o = document.createElement("object");
o.setAttribute("type", "application/x-shockwave-flash");
var t = b.appendChild(o);
});
</script>
</body>
</html>
jsFiddle here: http://jsfiddle.net/V9jtD/
It contains Zopim widget code, another async script that just adds an "object" tag to DOM. Let the above file be served by a webserver (you can use the jsFiddle: http://fiddle.jshell.net/V9jtD/show/). Open it in MacOSX Firefox 15+ with Firebug activated.
You will see the following error repeated many times:
TypeError: non-native scope object
If the errors donot show up, just refresh the page. And mainly Zopim fails to show up (sometimes appears with incomplete functionality). I could not reproduce this in Firefox/Ubuntu. (It might be reproducible in Firefox/Windows I could not check).
However, in the following cases Zopim loads fine:
Comment out "var t = b.appendChild(o);" (ie. dont append the "object" tag to DOM, or you can just remove second script tag entirely).
Deactivate Firebug.
I essentially want to understand who is causing the error so I can debug it.
Is it Firebug, because deactivating it Zopim works fine? But then removing the second script tag with Firebug enabled does not cause the error.
Is it the second script tag, because removing it Zopim works fine? But then deactivate Firebug and Zopim works fine even with second script tag.
Or is it Zopim itself?
Note that the content in the second script tag is part of function testPlayerVersion() in swfobject.js. I have hit this error when I am trying to add Zopim to a page that already has swfobject.
It would probably be easier to work out if the fiddle wasn't loading minified JS from Zopim, but the offending line (roughly beautified) is:
try {
(0)()
} catch (v) {
s = v.arguments ?
'chrome' : v.stack ?
'firefox' : window.opera && !('stacktrace' in v) ?
'opera' : 'other'
}
Which looks like a hacky way of detecting the browser. I'm not sure why it's causing Firebug to bail, it might be worth raising an issue with them if it's reproducible.
So, I've got this aspx page which includes 4 javascipt files like so:
<script src="Scripts/invoicePrimary.js" type="text/javascript"></script>
<script src="Scripts/invoiceBillOfLading.js" type="text/javascript"></script>
<script src="Scripts/invoiceCharge.js" type="text/javascript"></script>
<script src="Scripts/invoiceInvoice.js" type="text/javascript"></script>
Each of those defines a variable. invoicePrimary declares classPrimary, invoiceBillOfLading defines classBillOfLading, etc.
Later on in the page, we make reference to classPrimary, which makes reference to the others. The problem is that only half of them are defined. Specifically, classPrimary and classCharge are defined, while classBillOfLading an classInvoice are undefined.
This only happens in IE. Both in IE9 and IE9 acting as IE8. The whole site is designed for IE, so the rest of the stuff doesn't work in other browsers, but this part does. Does anyone have any ideas? Edit: As a note, all files are loaded as seen in Visual Studio's Script Documents folder.
Edit: The actual code which has problems:
populateScreenFromObject: function() {
if (invoiceFolder == null) return;
if (invoiceFolder.BillOfLadings != null) classBillOfLading.AddList(invoiceFolder.BillOfLadings);
if (invoiceFolder.Invoices != null) classInvoice.AddList(invoiceFolder.Invoices);
if (invoiceFolder.Charges != null) classCharge.FirstTimeLoad(invoiceFolder.Charges);
classInvoice.FirstTimeLoad();
classCharge.DisableNonDraftRadios();
classBillOfLading.Add(); // In case BOL number is prepopulated
},
This is a function in classPrimary, which is called from the main page like so: classPrimary.PopulateScreen(); At this point, classCharge is the only one of those classes which is defined. The only thing that happens before this is loading invoiceFolder data from json stored in a hidden field.
As it turns out, the problem was that the invoiced*.js files that weren't loading had a , at the end of the last function, so it wasn't expecting to end. IE8 just ignored this, as did other browsers, but IE9 threw a fit.
Try it in the real IE8. IE9 has caused a lot of breakage in IE.
It seems this is a known problem and has been asked several times before here in SO however I do not see anything specific to jQTouch so I thought I would give it a try.
jQT will dynamically load pages when a link is clicked. In this page I would like to include something like
<script>
$.include('javascriptfile.js', function() {alert('do something with results of this file to an already existing div element');};
</script>
The $.include is a jquery plugin I found that mimics the $.load with a few more smarts added to it. Tested to work on FF but not in Chrome or most importantly, Safari.
The alert is never displayed. FireBug never shows the javascript even being loaded. If I put an alert before the $.include I still do not see anything.
I have tried an onclick/ontap event that would then run this code that was included in the head tag, no luck.
Edit: I am using the r148 revision of jQT. This was working prior to moving to this version, i believe.
Did you try to add the javascript file using one of these two methods:
Static Way:
<script type="text/javascript">
function staticLoadScript(url){
document.write('<script src="', url, '" type="text/JavaScript"><\/script>');
}
staticLoadScript("javascriptfile.js");
modifyDivFn(processFnInFile());
</script>
Dynamic way:
<script type="text/javascript">
function dhtmlLoadScript(url){
var e = document.createElement("script");
e.src = url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
onload = function(){
dhtmlLoadScript("javascriptfile.js");
modifyDivFn(processFnInFile());
}
</script>
After the include you can call a function that does the processing you want (that being processFnInFile()) which result will be passed to modifyDivFn (and modify the div you want.) You could do this in one function, just to illustrate the idea.
Source: Dynamically Loading Javascript Files
Well Geries, I appreciate your help but ultimately the answer required a drastic rethinking of how I was using JQTouch. The solution was to move everything to an onclick event and make all the hrefs link to #. This might be what you were talking about Geries.
In the onclick function I do the logic, preloading, loading of the page through my own GET through jquery, then use the public object jQT.goTo(div, transition). This seems to get around the WebKit bugs or whatever I was running into and this now owrks on FireFox, Chrome, Safari, iPhone, and the lot.
I do run into a few animation issues with JQT but I think these are known issues that I hope Stark and the gang at JQTouch are working on.