X
Tap here to go to the mobile version of the site.
Your Firefox is out of date and may contain a security risk! Upgrade Firefox

Support Forum

My javascript is not working on Firefox

Posted

I have written a very small javascript. It works perfectly on IE but it is not working on Firefox. Each and every javascript I write, meet the same problem. Javascript is not dissabled in my firefox browser, and I am using the latest version(3.6.9). This is one of my scripts.

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Untitled Document</title> <script language="javascript"> function namechecker() { var firstNameLength = txtFirstName.value.length; while (firstNameLength==0) { firstNameLength=prompt("Enter your First Name",""); txtFirstName.value = firstNameLength; } } </script> Enter your First Name: <input name="txtFirstName" type="text">
Enter your Last Name: <input name="txtlastName" onfocus="namechecker()" type="text">

Chosen solution

This problem continues to occur for me after updating to 3.6.10. Numerous web sites, even Google, become unusable due to JavaScript errors. The problem can be fixed by clearing the cache. I also noticed that some images for certain pages did not load until the cache was cleared, so I suspect this is not a JavaScript problem but a bug in the way Firefox handles caching. Unfortunately I still cannot systematically reproduce this problem.

This problem occurs on 2 separate machines that are both running Windows 7 Pro 64-bit. Some extensions installed: Firebug (disabled), Xmarks.

One page that I'm trouble with right now is http://cgsmd.isi.edu/dbsnpq. The errors are "$ is not defined", "jQuery is not defined", and some of the images don't show up, while some do show up. When I go to about:cache?device=disk I can located the URL for the JavaScript file. When I follow the links to this cache entry, and I can see that the corresponding cache file does not exist. This is the file:

C:\Users\Scott\AppData\Local\Mozilla\Firefox\Profiles\jlz39414.default\Cache\83E84132d01

I did the same thing for some images. Some I can track down in about:cache and view them, other are listed but the data is not found - these are the ones that did not originally display. In about:cache it claims these items were just cached minutes ago, so it is unlikely some other "cleaning" software is deleting these files.

Conclusion: there are bugs in the Firefox cache system that make many common web sites, such as Google, unusable.

Read this answer in context 14

Additional System Details

This happened

Every time Firefox opened

Installed Plug-ins

  • The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
  • NPRuntime Script Plug-in Library for Java(TM) Deploy
  • Adobe PDF Plug-In For Firefox and Netscape "9.3.4"
  • Default Plug-in
  • Shockwave Flash 10.1 r82
  • DivX Web Player version 1.4.3.4
  • npdivxplayerplugin
  • Picasa plugin
  • Next Generation Java Plug-in 1.6.0_21 for Mozilla browsers
  • Yahoo Application State Plugin version 1.0.0.7
  • Version 1.1.4, copyright 1996-2010 The VideoLAN Teamhttp://www.videolan.org/
  • Npdsplay dll
  • DRM Store Netscape Plugin
  • DRM Netscape Network Object

Application

  • User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9

More Information

ssaccone 1 solutions 4 answers

I recently upgraded to Firefox 3.6.9. Today I noticed several web pages no longer work. I see many JavaScript errors in Firebug. They all say "is not defined" or "is undefined". Web sites include: https://www.google.com/analytics, the premier login page at http://dell.com, and one of my own sites. These sites work fine in IE and Chrome . I have not tried yohanrw's script. My system:

Windows 7 Pro 64-bit

These sites are no longer functional. This is a very serious problem.

ssaccone 1 solutions 4 answers

When I downgraded to Firefox 3.6.8 all the problems went away. When I upgraded back to 3.6.9, the problem did NOT return. That is, reinstalling 3.6.9 seems to have fixed the problem.

Question owner

as " ssaccone " said some of the codes worked on previous versions of Firefox, but not all of them. Is there a way to inform this matter directly to the Firefox team?

ssaccone 1 solutions 4 answers

This problem returned after I used my freshly reinstalled 3.6.9 application for 1 day. I first noticed it when clicking "Settings" in a basic Google search page did nothing. Sure enough, many other JavaScript pages then failed with errors like "$ not defined" and "jQuery not defined". However, not all pages failed. For example, a very simple jQuery page with this code worked: $('#myTest').html("<h1>jQuery Works!</h1>"). (I don't know how to insert code in this forum).

This time I was able to solve the problem by simply clearing the cache in Firefox.

Is it possible that one page could alter cached JavaScript on which another page relies, thus disabling the second page?

Note: I am NOT able to systematically reproduce this problem.

Modified by ssaccone

ssaccone 1 solutions 4 answers

Chosen Solution

This problem continues to occur for me after updating to 3.6.10. Numerous web sites, even Google, become unusable due to JavaScript errors. The problem can be fixed by clearing the cache. I also noticed that some images for certain pages did not load until the cache was cleared, so I suspect this is not a JavaScript problem but a bug in the way Firefox handles caching. Unfortunately I still cannot systematically reproduce this problem.

This problem occurs on 2 separate machines that are both running Windows 7 Pro 64-bit. Some extensions installed: Firebug (disabled), Xmarks.

One page that I'm trouble with right now is http://cgsmd.isi.edu/dbsnpq. The errors are "$ is not defined", "jQuery is not defined", and some of the images don't show up, while some do show up. When I go to about:cache?device=disk I can located the URL for the JavaScript file. When I follow the links to this cache entry, and I can see that the corresponding cache file does not exist. This is the file:

C:\Users\Scott\AppData\Local\Mozilla\Firefox\Profiles\jlz39414.default\Cache\83E84132d01

I did the same thing for some images. Some I can track down in about:cache and view them, other are listed but the data is not found - these are the ones that did not originally display. In about:cache it claims these items were just cached minutes ago, so it is unlikely some other "cleaning" software is deleting these files.

Conclusion: there are bugs in the Firefox cache system that make many common web sites, such as Google, unusable.

Question owner

hello ssaccone,

Sorry for the late reply. Could you please mention me how to clear the cache in FireFox?

cor-el
  • Top 10 Contributor
  • Moderator
10776 solutions 96959 answers

Helpful Reply

"Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"

See also Remove recent browsing, search and download history

Question owner

Thanks everyone for the help..And I guess Firefox team should constraint about this matter.

geoffgolder 0 solutions 1 answers

Is this related to a specific bug? I am terrible at sorting through bugzilla.

cor-el
  • Top 10 Contributor
  • Moderator
10776 solutions 96959 answers

You need to use at least id instead of name or document.getElementById to make the code work in Firefox.

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled Document</title>
<script language="javascript"> function namechecker() { var firstNameLength = txtFirstName.value.length; while (firstNameLength==0) { firstNameLength=prompt("Enter your First Name",""); txtFirstName.value = firstNameLength; } } </script>
Enter your First Name: <input id="txtFirstName" type="text">
Enter your Last Name: <input id="txtlastName" onfocus="namechecker()" type="text">
tunjin 0 solutions 4 answers

i'm firefox 5.0-6.1-x86-64 javascript not work pupop windows...but firefox 4 was worked... see example site for test javascript chromium is worked... test:http://ns20373.ovh.net/~coyhot/code_Blender.htm try to click on image javascript "javascript:popImage('Gallery/Stills/Code/Blender/patch_Threshold_Setup.jpg','Simple%20setup%20of%20the%20Threshold%20node')" but why???this is very important to be resolve as soon

cor-el
  • Top 10 Contributor
  • Moderator
10776 solutions 96959 answers

That popup with KB shows fine here in Firefox 5.

Start Firefox in Troubleshoot Firefox issues using Safe Mode to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).

tunjin 0 solutions 4 answers

hello i did safe mode it's work perfect but not-safe mode not work...my addons: -adblock -barlesque -bookmarks menu -cache status -chatzilla -download statusbar -downthemall! -extension opensuse for firefox -feedback -firebug -firefox 4 ui fixer -fireftp -firegestures -flagfox flashgot image-show-hide image zoom pearlcrescent page saver basic right-click-link speed dial empty cache

...where is error?