X
Tap here to go to the mobile version of the site.

Support Forum

Javascript not working in Firefox on Mac OS 10.9.2

Posted

I am trying to learn Javascript from a tutorial. I'm using Text edit to create a simple .html file that calls a .js file using the script command. The .html file opens normally in the default browser and can print a message to a simple page. It looks like a window tries to open the .js file but it vanishes before opening. I have checked that Javascript is enabled in Firefox. Opening Firefox in Safe mode does not fix the problem. It also fails to execute the .js file in Safari and Chrome.

This problem happens on three Macs, all running Mavericks 10.9.2. When I try this on a Windows PC the .js file executes as expected.

I've tried everything I can think of including turning off the Firewall in Security Settings. It seems like it has to be something system-wide since it happens in all three browsers. Has Apple implemented some type of blocking of Javascript in Mavericks? Any suggestions for why this is not working on my Macs and what I can do to fix it would be greatly appreciated!

I am trying to learn Javascript from a tutorial. I'm using Text edit to create a simple .html file that calls a .js file using the script command. The .html file opens normally in the default browser and can print a message to a simple page. It looks like a window tries to open the .js file but it vanishes before opening. I have checked that Javascript is enabled in Firefox. Opening Firefox in Safe mode does not fix the problem. It also fails to execute the .js file in Safari and Chrome. This problem happens on three Macs, all running Mavericks 10.9.2. When I try this on a Windows PC the .js file executes as expected. I've tried everything I can think of including turning off the Firewall in Security Settings. It seems like it has to be something system-wide since it happens in all three browsers. Has Apple implemented some type of blocking of Javascript in Mavericks? Any suggestions for why this is not working on my Macs and what I can do to fix it would be greatly appreciated!

Chosen solution

Note that your alert and prompt code is using Unicode quotes (“Hello world”) and not normal quotes (")

Read this answer in context 4

Additional System Details

Installed Plug-ins

  • Folx 3 plug-in. Allows downloads to be redirected to Eltima Folx 3.
  • Version 5.2.4.18058
  • Shockwave Flash 12.0 r0
  • Provides information about the default web browser
  • The QuickTime Plugin allows you to view a wide variety of multimedia content in web pages. For more information, visit the QuickTime Web site.
  • Microsoft Office for Mac SharePoint Browser Plug-in
  • Displays Java applet content, or a placeholder if Java is not installed.
  • 5.1.20513.0
  • Office Live Update v1.0
  • Amazon MP3 Downloader Plugin 1.0.17
  • LogMeIn remote control components
  • The Flip4Mac WMV Plugin allows you to view Windows Media content using QuickTime.
  • Musicnotes Viewer plugin 1.18.8 http://www.musicnotes.com
  • iPhoto6

Application

  • Firefox 28.0
  • User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0
  • Support URL: https://support.mozilla.org/1/firefox/28.0/Darwin/en-US/

Extensions

  • 1Password 4.1.0 (onepassword4@agilebits.com)
  • DownloadHelper 4.9.22 ({b9db16a4-6edc-47ec-a1f4-b86292ed211d})
  • DownThemAll! 2.0.16 ({DDC359D1-844A-42a7-9AA1-88A850A938A8})
  • feedly 16.0.528 (feedly@devhd)
  • Troubleshooter 1.1a (troubleshooter@mozilla.org)
  • Zotero 4.0.19 (zotero@chnm.gmu.edu)
  • Google Toolbar for Firefox 7.1.20101113Mb1 ({3112ca9c-de6d-4884-a869-9855de68056c}) (Inactive)

Javascript

  • incrementalGCEnabled: True

Graphics

  • adapterDescription:
  • adapterDeviceID: 0x 116
  • adapterDrivers:
  • adapterRAM:
  • adapterVendorID: 0x8086
  • driverDate:
  • driverVersion:
  • info: {u'AzureCanvasBackend': u'quartz', u'AzureFallbackCanvasBackend': u'none', u'AzureContentBackend': u'quartz', u'AzureSkiaAccelerated': 0}
  • numAcceleratedWindows: 1
  • numTotalWindows: 1
  • webglRenderer: Intel Inc. -- Intel HD Graphics 3000 OpenGL Engine
  • windowLayerManagerRemote: True
  • windowLayerManagerType: OpenGL

Modified Preferences

  • accessibility.typeaheadfind: True
  • accessibility.typeaheadfind.flashBar: 0
  • browser.cache.disk.capacity: 358400
  • browser.cache.disk.smart_size.first_run: False
  • browser.cache.disk.smart_size.use_old_max: False
  • browser.cache.disk.smart_size_cached_value: 358400
  • browser.fixup.alternate.enabled: False
  • browser.history_expire_days.mirror: 180
  • browser.places.importBookmarksHTML: False
  • browser.places.importDefaults: False
  • browser.places.leftPaneFolderId: -1
  • browser.places.migratePostDataAnnotations: False
  • browser.places.smartBookmarksVersion: 6
  • browser.places.updateRecentTagsUri: False
  • browser.search.useDBForOrder: True
  • browser.sessionstore.upgradeBackup.latestBuildID: 20140314220517
  • browser.startup.homepage: http://my.yahoo.com/
  • browser.startup.homepage_override.buildID: 20140314220517
  • browser.startup.homepage_override.mstone: 28.0
  • browser.tabs.warnOnClose: False
  • dom.disable_open_during_load: False
  • dom.max_chrome_script_run_time: 0
  • dom.mozApps.used: True
  • dom.w3c_touch_events.expose: False
  • extensions.lastAppVersion: 28.0
  • font.internaluseonly.changed: True
  • network.cookie.prefsMigrated: True
  • network.enableIDN: False
  • network.protocol-handler.warn-external.itms: False
  • places.database.lastMaintenance: 1396201482
  • places.history.expiration.transient_current_max_pages: 104858
  • places.last_vacuum: 1297057928
  • plugin.disable_full_page_plugin_for_types: application/pdf
  • plugin.importedState: True
  • plugin.state.adobepdfviewernpapi: 0
  • plugin.state.scorch: 0
  • privacy.cpd.cookies: False
  • privacy.donottrackheader.enabled: True
  • privacy.popups.firstTime: False
  • privacy.sanitize.migrateFx3Prefs: True
  • privacy.sanitize.timeSpan: 0
  • security.disable_button.openCertManager: False
  • security.disable_button.openDeviceManager: False
  • security.OCSP.disable_button.managecrl: False
  • security.OCSP.enabled: 0
  • security.OCSP.signingCA: Builtin Object Token:Verisign Class 1 Public Primary OCSP Responder
  • security.OCSP.URL:
  • security.warn_viewing_mixed: False
  • storage.vacuum.last.index: 1
  • storage.vacuum.last.places.sqlite: 1395198443

Misc

  • User JS: No
  • Accessibility: No
jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

It's hard to troubleshoot without seeing the script, and it's rare that script which works on Windows wouldn't work on Mac...

When you say a window opens, do you mean a pop-up window (script method window.open())? Do your Macs have any security software installed that might suppress Firefox popups that your Windows PCs do not have?

It's hard to troubleshoot without seeing the script, and it's rare that script which works on Windows wouldn't work on Mac... When you say a window opens, do you mean a pop-up window (script method window.open())? Do your Macs have any security software installed that might suppress Firefox popups that your Windows PCs do not have?

Question owner

Hi jscher,

Here is the file container.html that will print "This is a simple page" in a blank page of Firefox. The next command should call the script.js file but it doesn't work on the Mac, only on the PC.

<html>
	<head>
		<title>Simple Page</title>
	</head>
	<body>
		<p>This is a simple page</p>
		<script src=“script.js”></script>
	</body>
</html>

Here is the content of the script.js file:

alert(“Hello world”);
var name = prompt(“What is your name?”);
alert(“Hello, “ + name);

Again, script.js gets called on the PC and executes as expected. On the Mac it looks like a window TRIES to open (starts to zoom out from the center of the page) but then fails to open a new window. I am not aware of any security software on the Mac that suppresses Firefox popups but I do recall that Firefox usually asks me if I want to allow a popup when a website tries to open one. In the case of my .js script I do not see an alert asking if I want to allow a popup.

Thanks for trying to help. Please let me know if this information provides any clue as to what is wrong.

Gene

Hi jscher, Here is the file container.html that will print "This is a simple page" in a blank page of Firefox. The next command should call the script.js file but it doesn't work on the Mac, only on the PC. <pre><nowiki><html> <head> <title>Simple Page</title> </head> <body> <p>This is a simple page</p> <script src=“script.js”></script> </body> </html></nowiki></pre> Here is the content of the script.js file: alert(“Hello world”); var name = prompt(“What is your name?”); alert(“Hello, “ + name); Again, script.js gets called on the PC and executes as expected. On the Mac it looks like a window TRIES to open (starts to zoom out from the center of the page) but then fails to open a new window. I am not aware of any security software on the Mac that suppresses Firefox popups but I do recall that Firefox usually asks me if I want to allow a popup when a website tries to open one. In the case of my .js script I do not see an alert asking if I want to allow a popup. Thanks for trying to help. Please let me know if this information provides any clue as to what is wrong. Gene

Modified by cor-el

jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

There is a limit on the number of these modal dialogs (alert, prompt, confirm) that a site can show in a row without some user action in between. But I would expect Firefox on Mac to be the same as Firefox on Windows in that regard. Hopefully a Mac user will have more insight than I do.

There is a limit on the number of these modal dialogs (alert, prompt, confirm) that a site can show in a row without some user action in between. But I would expect Firefox on Mac to be the same as Firefox on Windows in that regard. Hopefully a Mac user will have more insight than I do.

Question owner

I just realized that the scripts did not copy/paste correctly. Here is container.html

<title>Simple Page</title>

This is a simple page

<script src="“script.js”"></script>

And here is script.js

alert(“Hello world”); var name = prompt(“What is your name?”); alert(“Hello, “ + name);

I just realized that the scripts did not copy/paste correctly. Here is container.html <html> <head> <title>Simple Page</title> </head> <body> <p>This is a simple page</p> <script src=“script.js”></script> </body> </html> And here is script.js alert(“Hello world”); var name = prompt(“What is your name?”); alert(“Hello, “ + name);

Question owner

Still not pasting correctly. The forum must be interpreting the text.

jscher: Thanks for taking a look. Let's hope a Mac genius can provide some insight here!

Still not pasting correctly. The forum must be interpreting the text. jscher: Thanks for taking a look. Let's hope a Mac genius can provide some insight here!
jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

Can you confirm that your script is running by adding a new first command. For example:

document.body.style.background = "#ffc"; // pale yellow page background

(To keep line breaks in your code when posting here, start each new line with a space.)

And you can check for error messages in Firefox's Browser Console. Either:

  • Command + Shift + j (Windows: Ctrl+Shift+j)
  • Tools menu > Web Developer > Browser Console

It often helps to click the clear button, switch back to your page and reload, then come back to the console to check for fresh messages.

Can you confirm that your script is running by adding a new first command. For example: document.body.style.background = "#ffc"; // pale yellow page background (To keep line breaks in your code when posting here, start each new line with a space.) And you can check for error messages in Firefox's Browser Console. Either: * Command + Shift + j (Windows: Ctrl+Shift+j) * Tools menu > Web Developer > Browser Console It often helps to click the clear button, switch back to your page and reload, then come back to the console to check for fresh messages.
jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

Not sure whether it's the forum or your code, but: can you set text edit not to substitute fancy / smart quotation marks for straight ones? Those may be causing problems for Firefox.

Not sure whether it's the forum or your code, but: can you set text edit not to substitute fancy / smart quotation marks for straight ones? Those may be causing problems for Firefox.

Question owner

jscher: Pasting in your first line did not change the behavior. No pale yellow background.

Does that mean the script.js file is not getting called? Still don't see why this works on a PC but not on a Mac...

jscher: Pasting in your first line did not change the behavior. No pale yellow background. Does that mean the script.js file is not getting called? Still don't see why this works on a PC but not on a Mac...
jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

If the page background does not change, it sounds as though the file is not being executed.

Because the forum sometimes eats HTML, I'm not sure whether your posts accurately show the full page content. Could you try this:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test Page</title>
</head>
<body>
<p>Look for dialogs!</p>
<script type="text/javascript" src="script.js"></script> 
</body>
</html>
If the page background does not change, it sounds as though the file is not being executed. Because the forum sometimes eats HTML, I'm not sure whether your posts accurately show the full page content. Could you try this: &lt;!DOCTYPE html> &lt;html> &lt;head> &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"> &lt;title>Test Page&lt;/title> &lt;/head> &lt;body> &lt;p>Look for dialogs!&lt;/p> &lt;script type="text/javascript" src="script.js">&lt;/script> &lt;/body> &lt;/html>
cor-el
  • Top 10 Contributor
  • Moderator
12328 solutions 114054 answers

Chosen Solution

Note that your alert and prompt code is using Unicode quotes (“Hello world”) and not normal quotes (")

Note that your alert and prompt code is using Unicode quotes (“Hello world”) and not normal quotes (")

Helpful Reply

Cor-el: Thank you for noticing that! Turning off smart quotes in Textedit which I am using to create the scripts solved the problem. Everything working as expected now. I hope others using Mac OS 10.9.2 will benefit from this as well.

Cor-el: Thank you for noticing that! Turning off smart quotes in Textedit which I am using to create the scripts solved the problem. Everything working as expected now. I hope others using Mac OS 10.9.2 will benefit from this as well.
atar 1 solutions 3 answers

I'm having somewhat of a similar problem, BUT....

I built a html5/JS animation (using Flash CS6) and put it online to test it. This animation plays perfectly in EVERY BROWSER, EXCEPT FIREFOX.

One weird thing though, if I right-click the offline html file and choose "open with > Firefox" it DOES play the animation.

I'm also working with OSX 10.9.2 but the exact same thing happens on Windows PC.

Why can't I get the online version to work, where's the difference? I need this animation to work on a website.

View the full source code and animation here: http://www.access.gr/attiki/test1.html

I'm having somewhat of a similar problem, BUT.... I built a html5/JS animation (using Flash CS6) and put it online to test it. This animation plays perfectly in EVERY BROWSER, EXCEPT FIREFOX. One weird thing though, if I right-click the offline html file and choose "open with > Firefox" it DOES play the animation. I'm also working with OSX 10.9.2 but the exact same thing happens on Windows PC. Why can't I get the online version to work, where's the difference? I need this animation to work on a website. View the full source code and animation here: http://www.access.gr/attiki/test1.html
jscher2000
  • Top 10 Contributor
3260 solutions 29716 answers

Hi atar, I moved my reply to your new thread: html5 doesn't play online but DOES play offline.

Hi atar, I moved my reply to your new thread: [https://support.mozilla.org/questions/993994 html5 doesn't play online but DOES play offline].

Modified by jscher2000