jQuery flash object click event not firing in IE or Chrome - javascript

I'm just trying to understand a difference between IE, Chrome and Firefox. I have the following code on a page:
$('object').live('click', function(){
alert('Fired');
});
I then populate the page with some Flash controls (in my case, I'm using Uploadify). When I click on the Flash control, I see the alert in Firefox 4. However, I do not see the alert in IE8 or Chrome (I havent tested any other browsers).
Is there something obvious I'm missing?
Many thanks.

Could we see more code? This seems like it should work, so I can see why you're puzzled. Could be a syntactical error in your markup. Maybe try something like this, unless you have a specific reason for the live().
$('object').click(function() {
alert('Fired!');
});

Related

IE 11 showing error when i clicking with jquery function

IE so much confusing me with some errors like this,
SCRIPT1002: Syntax error
File: jquery-2.1.4.min.js, Line:2 Column 2538
The weird thing is , on firefox and chrome running well and no error.
And some button with jquery click function is working.
I'm Using IE 11
Before this i'm using jquery-1.1.13.min.js and when i use jquery 2.0 it still running properly on firefox and chrome
I'm really new with cross browser so any info will helping me very much, thanks :)
For the record I had this error which only showed itself on IE when doing cross-browser testing of a big Javascript code change.
In my case the problem was a function definition which included what would be a default in any other language:
i.e. Function Foo(param1, param2, param3=false)
.. clearly this was a stupid bit of code .. but it took me a while to track down so this might help someone out there. Doesn't show up in Chrome, FF, or even Edge.
Mostly these errors are not problems of jQuery itself. The problem situates in code using jQuery or inserted into jQuery (callbacks or event functionalities). In my case I used $.ajax to load a remote page in a div element. In the page I loaded there where // comment tags in the javascript part. As IE is putting this content on one line, more code that as I wanted was commented and this created the error.
So if in our case us are using $.ajax maybe this can be an issue. Otherwise best thing to do is debugging the code that generates this error and look for code that is not supported by IE (the version you use). Look for functions passed trough to jQuery.

Hammer JS v2.0.4 not recognizing 'panstart' or 'panmove' in Chrome 37.0 only

I wanted to learn Hammer JS by building a simple program to drag an element around the screen, pretty much just like the same on the Hammer homepage.
I used the code posted on the Hammer github page, which seems to be the same code used on the homepage. I was testing the work in Chrome (37.0 / OSX). After working with it for a while and being unable to get the element to move, I opened the same page in Safari and FF. It worked perfectly in both of those browsers.
To pare things down, I added just the required to code to see an event trigger:
var mover = document.getElementById("mover");
var mc = new Hammer.Manager(mover);
mc.add(new Hammer.Pan({ threshold: 0, pointers: 0 }));
mc.on("panstart panmove", function(ev) {
console.log(ev);
});
Nothing gets logged in Chrome, but I get proper logging as expected in Safari and FF. I extended the event listener to include 'pan, panend, pancancel, panleft, panright, panup, pandown'. These events WOULD log in Chrome, so it seems like only panstart and panmove were being ignored.
So this code will run on the hammer.js page in Chrome, so clearly Chrome does see the panstart and panmove events in that browser, it's just not happening in my code. Which means somehow I am missing something, despite copying the code over from their site. I checked we were on the same Hammer version, but I am not sure sure what else from here I need to check.
Has anyone else encountered and solved this problem? Or perhaps knows what I am doing wrong to create this issue?
Thanks.
In the Hammer site say clearly "for better performance on slower devices your should try to keep you callbacks as simple as possible." I think that's the same with Browsers!
Maybe your problem is
var mover = document.getElementById("#mover");
Why do you type "#mover" instead of "mover"? The "#" sign it's for JQuery and you are using plain javascript. It confuses me that in some browsers this works, so I imagine your ElementID start in fact with the "#"...
Let me know if it helped, please!

how to do document.ondrop in firefox?

The document.ondrop seems to work in chrome, but not in firefox?
Attached is an example:
http://auth.letschat.info/test2.php
If you drop a file on to the page it should pop up an alert box. However it doesn't work in firefox, but does in chrome.
When I use firefox console the document.ondrop handler is correctly set.
Assuming the original javascript looks like this and works in Chrome:
document.ondrop=function(event){
alert("hello");
}
It can be changed to work in both Firefox and Chrome. Firefox requires you to stop the default action from occuring when you drag a file over, which can be solved by using the ondragover event. The following javascript code will also work in Firefox:
document.ondragover = function(event){
event.preventDefault();
}
document.ondrop=function(event){
alert("hello");
}
I found this solution by looking at w3schools and looking for the differences between their simple example and your code.
From html5rocks on slide #18 there is also an html5 example of another way to use drag and drop by adding the listener to the page.

Jquery Error in ie8 and ie9 with Wordpress theme. (Object doesnt support this property or method)

I recently launched a website for a client http://www.bridgechurch.us/ only to recieve complaints of it not displaying correctly on ie8 or ie9. I have confirmed this to be true. IE is pointing to this line of Javascript:
jQuery(function () {
jQuery(".scrollable").scrollable({circular: true}).navigator().autoscroll({interval: 7000});
[...]
Can anyone help me figure out what is wrong with this line of code?
Thank you
UPDATE - FIXED
I figured out that there was a comment before the Doctype Declaration that forced IE into quirks mode.
You have a lot of 404's on that page, mainly related to ie-specific css and border images, which is probably why the page doesn't look like it should. Files like /images/internet_explorer/borderBottomRight.png and /wp-content/themes/Moses/styles/default.css aren't loading.
That being said, looking at the scrollable documentation, there is no .navigator() function off of the return value of scrollable(); and I'm getting the same error in Chrome.
Well, visually, the site doesn't appear to work well at all in IE9 (compared to Chrome). But just looking at the code that adds scrollable() to jQuery, you can see that that function doesn't always return the original element. In your code, if you split the call into two, you might be ok:
jQuery(".scrollable").scrollable({circular: true});
jQuery(".scrollable").navigator().autoscroll({interval: 7000});
I blame the plug-in on this one: functions that extend jQuery are supposed to always return the original elements found by the selector.

I have set services.sync.prefs.sync.dom.disable_window_move_resize;false but resizeTo() still doesnt work

I am using Aurora 14.0a2 as my default browser (its the early release of firefox)
I have went into my about:config and have changed the value of services.sync.prefs.sync.dom.disable_window_move_resize; to false
Yet when I run my website the resizeTo(); function still doesn't work
here is my code:
jsfiddle_link
function onload(){
window.resizeTo(600,800);
}
I also tried it in other browsers:
Chrome (no surprise it didn't work since chrome never supports it)
opera
IE 8
Safari
None of which worked
I also tried making a link from a different website linking my website then clicking on it but it did not do the trick
any ideas?
I think the resize functionality of javascript would only work when you open it on popup windows and not when your openning it on a main browser window try checking on this link http://www.javascripter.net/faq/windowresizeto.htm it has the sample that I think would help you.

Categories

Resources