Tag: firefox

Why is array.push sometimes faster than array[n] = value?

As a side result of testing some code I wrote a small function to compare the speed of using the array.push method vs direct addressing (array[n] = value). To my surprise the push method often showed to be faster especially in Firefox and sometimes in Chrome. Just out of curiosity: anyone has an explanation for […]

After travelling back in Firefox history, JavaScript won't run

When I use the back button on Firefox to reach a previously visited page, scripts on that page won’t run again. Is there any fix/workaround to have the scripts execute again when viewing the page the second time? Please note that I have tested the same pages on Google Chrome and Internet Explorer and they […]

ReferenceError: event is not defined error in Firefox

I’ve made a page for a client and I initially was working in Chrome and forgot to check if it was working in Firefox. Now, I have a big problem because the whole page is based upon a script that doesn’t work in Firefox. It’s based on all “links” that have a rel that leads […]

new Date() is working in Chrome but not Firefox

I am creating a datetime string that looks like this: 2010-07-15 11:54:21 And with the following code I get invalid date in Firefox but works just fine in Chrome var todayDateTime = year + ‘-‘ + month + ‘-‘ + day + ‘ ‘ + hour + ‘:’ + minute + ‘:’ + seconds; var […]

How to get result of console.trace() as string in javascript with chrome or firefox?

console.trace() outputs its result on console. I want to get the results as string and save them to a file. I don’t define names for functions and I also can not get their names with callee.caller.name.

How can I make event.srcElement work in Firefox and what does it mean?

there is an if statement on my company’s website that makes one web page imcompatible with firefox if(event.srcElement.getAttribute(“onclick”) == null){ …code.. document.mainForm.submit(); } I’ve commented out the if statement conditions and now its working with forefox. My question is, what is event.srcElement.getAttribute(“onclick”), is it important, would it cause problems in the future. also, is there […]

Firefox 4 onBeforeUnload custom message

In Firefox 3, I was able to write a custom confirmation popup with: window.onbeforeunload = function() { if (someCondition) { return ‘Your stream will be turned off’; } } Now in Firefox 4, it does not show my custom message. The default message that it provides is not even accurate to what my application does. […]

Error: Attempt to run compile-and-go script on a cleared scope

Since upgrading to Firefox 4.0, I’ve noticed that I’m occasionally getting an error in the console stating: attempt to run compile-and-go script on a cleared scope The only information I can find about this on the net currently is on the mozilla groups forum, where it is suggested that it’s something to do with session […]

file is being assigned a //# sourceMappingURL but already has one

I just notice Firefox console outputs the following error for every single .js/.coffee file in my project (even the packages). -file- is being assigned a //# sourceMappingURL, but already has one Chrome’s console doesn’t show anything. I tried deleting all the .map files and clearing Firefox’s cache but I’m still getting the errors.

How to “break on property change” in chrome?

Firebug for firefox has a nice feature, called “Break on property change”, where I can mark any property of any object, and it will stop javascript execution right before the change. I’m trying to achieve the same in google chrome, and I can’t find the function in chrome debugger. How do I do this in […]