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

Support Forum

JSON response from PEAR received but not updating <div> via innerHTML

Posted
I have Firefox 11.0. With the latest PEAR, Firebug shows me that the proper response is coming back from an AJAX call. The target is .

It is supposed to put the response in via innerHTML. It doesn't. Now IE8 works fine in this case.

The PEAR modules have in them the check for 'Gecko' to cover the bug found in earlier versions of FF.

I have Firefox 11.0. With the latest PEAR, Firebug shows me that the proper response is coming back from an AJAX call. The target is <div id="navbar"></div>. It is supposed to put the response in via innerHTML. It doesn't. Now IE8 works fine in this case. The PEAR modules have in them the check for 'Gecko' to cover the bug found in earlier versions of FF.

Additional System Details

Installed Plug-ins

Firebug

Application

  • User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C)

More Information

jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

Are there any relevant script errors in the console (Ctrl+Shift+j)?

Is there any page online that demonstrates this problem? If so, a link would be helpful.

Are there any relevant script errors in the console (Ctrl+Shift+j)? Is there any page online that demonstrates this problem? If so, a link would be helpful.

Question owner

There were a number of errors. All were warnings except one. That one was:

Timestamp: 6/6/2012 7:21:30 PM Error: Components.classes['@mozilla.org/extensions/manager;1'] is undefined Source File: chrome://jqs/content/overlay.js Line: 9

Here is the file: // %W% %E% // // Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. // ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. //

// get the JQS extension directory const id = "jqs@sun.com"; var ext = Components.classes["@mozilla.org/extensions/manager;1"]

                   .getService(Components.interfaces.nsIExtensionManager)
                   .getInstallLocation(id)
                   .getItemLocation(id); 

// create an nsILocalFile for the executable var file = Components.classes["@mozilla.org/file/local;1"]

                    .createInstance(Components.interfaces.nsILocalFile);

// construct command line file.initWithPath(ext.path + "\\..\\..\\..\\..\\bin\\jqsnotify.exe");

// and launch it file.launch();


No, there is no page online as this is in an intranet behind a firewall that I access via VPN.


Before the error message there was a question mark message: Could not read chrome manifest 'file:///C:/Program%20Files/Mozilla%20Firefox/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/chrome.manifest'.

There were a number of errors. All were warnings except one. That one was: Timestamp: 6/6/2012 7:21:30 PM Error: Components.classes['@mozilla.org/extensions/manager;1'] is undefined Source File: chrome://jqs/content/overlay.js Line: 9 Here is the file: // %W% %E% // // Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. // ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. // // get the JQS extension directory const id = "jqs@sun.com"; var ext = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager) .getInstallLocation(id) .getItemLocation(id); // create an nsILocalFile for the executable var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); // construct command line file.initWithPath(ext.path + "\\..\\..\\..\\..\\bin\\jqsnotify.exe"); // and launch it file.launch(); No, there is no page online as this is in an intranet behind a firewall that I access via VPN. Before the error message there was a question mark message: Could not read chrome manifest 'file:///C:/Program%20Files/Mozilla%20Firefox/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/chrome.manifest'.
cor-el
  • Top 10 Contributor
  • Moderator
17467 solutions 157837 answers

You can disable the Java Quick Starter (JQS) extension.

  • Tools -> Add-ons -> Extensions
  • Control Panel -> Java -> Advanced tab -> Miscellaneous -> Java Quick Starter (disable)
You can disable the Java Quick Starter (JQS) extension. * Tools -> Add-ons -> Extensions * Control Panel -> Java -> Advanced tab -> Miscellaneous -> Java Quick Starter (disable)
jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

"jqs" is associated with the Java Quick Starter. This may or may not be relevant to your problem, but if you do have that add-on, you could try disabling it here and see whether that makes any difference:

orange Firefox button or classic Tools menu > Add-ons > Extensions (already mentioned above)


Do you know whether it works correctly from inside the LAN? Just wondering whether we can rule out the remote access as an issue.


A standard diagnostic step is to try Firefox's Safe Mode to see whether it is caused by a custom setting or add-on.

First, I recommend backing up your Firefox settings in case something goes wrong. See Backing up your information. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)

Next, restart Firefox in Safe Mode using

Help > Restart with Add-ons Disabled

In the Safe Mode dialog, do not check any boxes, just click "Continue in Safe Mode."

If the application operates correctly, this points to an add-on or custom setting as the likely problem.


Since I'm not familiar with PEAR and can't test, someone else will need to assist with further diagnosis.

<s>"jqs" is associated with the Java Quick Starter. This may or may not be relevant to your problem, but if you do have that add-on, you could try disabling it here and see whether that makes any difference: orange Firefox button ''or'' classic Tools menu > Add-ons > Extensions</s> ''(already mentioned above)'' ---- Do you know whether it works correctly from inside the LAN? Just wondering whether we can rule out the remote access as an issue. ---- A standard diagnostic step is to try Firefox's Safe Mode to see whether it is caused by a custom setting or add-on. First, I recommend backing up your Firefox settings in case something goes wrong. See [https://support.mozilla.org/en-US/kb/Backing+up+your+information Backing up your information]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.) Next, restart Firefox in [http://support.mozilla.org/kb/Safe+Mode Safe Mode] using Help > Restart with Add-ons Disabled In the Safe Mode dialog, do not check any boxes, just click "Continue in Safe Mode." If the application operates correctly, this points to an add-on or custom setting as the likely problem. ---- Since I'm not familiar with PEAR and can't test, someone else will need to assist with further diagnosis.

Modified by jscher2000

Question owner

I did the disabling of JQR and it made no difference.

I did the disabling of JQR and it made no difference.

Modified by sglickler

Question owner

It is not the remote access.

It is not the remote access.

Question owner

Restarting in Safe Mode with add-ons disabled made no difference.

Restarting in Safe Mode with add-ons disabled made no difference.
jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

By any chance have you tested in Firefox 13, just in case this is related to a fixed bug?

By any chance have you tested in Firefox 13, just in case this is related to a fixed bug?

Question owner

I upgraded to 13.0 and it still didn't work.

I upgraded to 13.0 and it still didn't work.

Question owner

OK, I have done a little more investigating (after going to version 13). The page that is put up is created from a template that Smarty uses. There is one place in it, a div with id of navbar, in the <body> area and that is the area that is to be painted with the innerHTML.

I used the javascript debugger to set a breakpoint at initApp(), the JS routine that is invoked on page load. I also put some text inside the div

In Internet Explorer 8, the text painted and then was replaced by the innerHTML. In Firefox, the text painted and it stopped at the initApp(). When I hit continue, it finished and the text I put there disappeared.

I also added a log to a file of what the echo is that is sent back to the browser. Of course, it matched exactly what Firebug had on the Console response. The response was absolutely identical in every way between when run in Firefox and in Internet Explorer.

So, what is happening is that Internet Explorer is properly running the script that is put back in innerHTML, but Firefox just puts up a blank. When I look in Firebug HTML in the div, I see a javascript, the one that is sent back. What it appears to boil down to is that this script is run in Enternet Explorer, but Firefox does not run it. (The script creates a menu structure). I can't see what IE has there because all it shows is a blank
(as does a view/source in Firefox).


Here is what is returned from the server: [{"action":"assign","id":"navbar","attributes":{"innerHTML":"<script type='text\/javascript'> var menu = new DHTMLSuite.menuModel();menu.addItem('1', 'Main Menu', , , false);menu.setSubMenuWidth('1',230);menu.addItem('11', 'pccr', , , '1');menu.setSubMenuWidth('11',230);menu.addItem('111', 'Master Configuration', , , '11');menu.setSubMenuWidth('111',230);menu.addItem('1111', 'Supplier Configuration', , , '111', , \"ajaxCall('pccr', 'SupplierConfigurationController', 'initialize', , 'dummyCallback')\");menu.addItem('1112', 'Dimension Configuration', , , '111', , \"ajaxCall('pccr', 'DimensionConfigurationController', 'initialize', , )\");menu.addItem('1113', 'Responsible Person', , , '111', , \"ajaxCall('pccr', 'ResponsiblePersonConfigurationController', 'initialize', , )\");menu.addItem('1114', 'Indirect Contracts', , , '111', , \"ajaxCall('pccr', 'IndirectContractsController', 'initialize', , )\");menu.addItem('1115', 'InterCompany Configuration', , , '111', , \"ajaxCall('pccr', 'InterCompanyConfigurationController', 'initialize', , )\");menu.addItem('112', 'Current Period Review', , , '11', , \"ajaxCall('pccr', 'CurrentPeriodReviewController', 'initialize', , )\");menu.addItem('113', 'PCCR History', , , '11', , \"ajaxCall('pccr', 'PccrHistoryController', 'initialize', , )\");menu.init(); var menuBar2 = new DHTMLSuite.menuBar();menuBar2.addMenuItems(menu);menuBar2.setTarget('navbar');menuBar2.init();<\/script>"}}]

Is there a way to force this to be run?

OK, I have done a little more investigating (after going to version 13). The page that is put up is created from a template that Smarty uses. There is one place in it, a div with id of navbar, in the <body> area and that is the area that is to be painted with the innerHTML. I used the javascript debugger to set a breakpoint at initApp(), the JS routine that is invoked on page load. I also put some text inside the div In Internet Explorer 8, the text painted and then was replaced by the innerHTML. In Firefox, the text painted and it stopped at the initApp(). When I hit continue, it finished and the text I put there disappeared. I also added a log to a file of what the echo is that is sent back to the browser. Of course, it matched exactly what Firebug had on the Console response. The response was absolutely identical in every way between when run in Firefox and in Internet Explorer. So, what is happening is that Internet Explorer is properly running the script that is put back in innerHTML, but Firefox just puts up a blank. When I look in Firebug HTML in the div, I see a javascript, the one that is sent back. What it appears to boil down to is that this script is run in Enternet Explorer, but Firefox does not run it. (The script creates a menu structure). I can't see what IE has there because all it shows is a blank <div> (as does a view/source in Firefox). Here is what is returned from the server: [{"action":"assign","id":"navbar","attributes":{"innerHTML":"<script type='text\/javascript'> var menu = new DHTMLSuite.menuModel();menu.addItem('1', 'Main Menu', '', '', false);menu.setSubMenuWidth('1',230);menu.addItem('11', 'pccr', '', '', '1');menu.setSubMenuWidth('11',230);menu.addItem('111', 'Master Configuration', '', '', '11');menu.setSubMenuWidth('111',230);menu.addItem('1111', 'Supplier Configuration', '', '', '111', '', \"ajaxCall('pccr', 'SupplierConfigurationController', 'initialize', '', 'dummyCallback')\");menu.addItem('1112', 'Dimension Configuration', '', '', '111', '', \"ajaxCall('pccr', 'DimensionConfigurationController', 'initialize', '', '')\");menu.addItem('1113', 'Responsible Person', '', '', '111', '', \"ajaxCall('pccr', 'ResponsiblePersonConfigurationController', 'initialize', '', '')\");menu.addItem('1114', 'Indirect Contracts', '', '', '111', '', \"ajaxCall('pccr', 'IndirectContractsController', 'initialize', '', '')\");menu.addItem('1115', 'InterCompany Configuration', '', '', '111', '', \"ajaxCall('pccr', 'InterCompanyConfigurationController', 'initialize', '', '')\");menu.addItem('112', 'Current Period Review', '', '', '11', '', \"ajaxCall('pccr', 'CurrentPeriodReviewController', 'initialize', '', '')\");menu.addItem('113', 'PCCR History', '', '', '11', '', \"ajaxCall('pccr', 'PccrHistoryController', 'initialize', '', '')\");menu.init(); var menuBar2 = new DHTMLSuite.menuBar();menuBar2.addMenuItems(menu);menuBar2.setTarget('navbar');menuBar2.init();<\/script>"}}] Is there a way to force this to be run?

Modified by sglickler

jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

In Firefox, View Source shows the original page. To see the modified page, first Select All (Ctrl+a) and then right-click and use View Selection Source. Then you'll probably see the script there.

This issue sounds familiar: for security reasons, I think Firefox might no longer parse scripts injected into a page in certain ways. Unfortunately, I haven't been able to find the relevant threads. However, if I am remembering correctly, there must be others who are running into this problem. What was the last version of Firefox in which this worked without a problem?

And, as an alternative to innerHTML, can you parse the response and create the <script> element using DOM methods instead?

Edit: I'm not familiar with "Smarty"; perhaps they have an update to address this?

In Firefox, View Source shows the original page. To see the modified page, first Select All (Ctrl+a) and then right-click and use View Selection Source. Then you'll probably see the script there. This issue sounds familiar: for security reasons, I think Firefox might no longer parse scripts injected into a page in certain ways. Unfortunately, I haven't been able to find the relevant threads. However, if I am remembering correctly, there must be others who are running into this problem. What was the last version of Firefox in which this worked without a problem? And, as an alternative to innerHTML, can you parse the response and create the &lt;script> element using DOM methods instead? Edit: I'm not familiar with "Smarty"; perhaps they have an update to address this?

Modified by jscher2000

Question owner

I don't know the last version of Firefox when it worked. It would be the latest version that was in place in Feb. 2008. That was when I downloaded it and used it in the development of the product.

I don't know the last version of Firefox when it worked. It would be the latest version that was in place in Feb. 2008. That was when I downloaded it and used it in the development of the product.
cor-el
  • Top 10 Contributor
  • Moderator
17467 solutions 157837 answers
Are there any errors in the Error Console about that script? *https://developer.mozilla.org/en/Error_Console Current Firefox version have a lot of other helpful tools. *https://developer.mozilla.org/en/Tools *https://developer.mozilla.org/en/Tools/Page_Inspector *https://developer.mozilla.org/en/Tools/Web_Console *https://developer.mozilla.org/en/Using_the_Web_Console

Question owner

I still have gotten nowhere on this. As far as I can see, what is sent back to the browser is a json encoded script for DHTMLSuite.menuModel and put into a . Both IE and Firefox put that script in place into that div via innerHTML. It is the running of this script that creates the actual menu. All of this is triggered by an onload in <body onload="initApp();">.

In IE this script is run, but in Firefox it is not. The AJAX is handled by PEAR modules.

I still have gotten nowhere on this. As far as I can see, what is sent back to the browser is a json encoded script for DHTMLSuite.menuModel and put into a <div id="navbar"></div>. Both IE and Firefox put that script in place into that div via innerHTML. It is the running of this script that creates the actual menu. All of this is triggered by an onload in <body onload="initApp();">. In IE this script is run, but in Firefox it is not. The AJAX is handled by PEAR modules.
jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

I suggested: as an alternative to innerHTML, can you parse the response and create the <script> element using DOM methods instead?

However, if there is no compelling reason to send the fully formed script from the server, it seems easier to have the script in the callback handling the JSON response, where it can then draw the menu using the parameters sent from the server.

Related threads:

I suggested: ''as an alternative to innerHTML, can you parse the response and create the <script> element using DOM methods instead?'' However, if there is no compelling reason to send the fully formed script from the server, it seems easier to have the script in the callback handling the JSON response, where it can then draw the menu using the parameters sent from the server. Related threads: * [http://www.highdots.com/forums/javascript/js-injection-firefox-373061.html JS injection in Firefox - HighDots Forums] (yours) * [http://stackoverflow.com/questions/10934494/innerhtml-html-jquery-jquery-doesnt-execute javascript - innerHTML = HTML & JQuery, JQuery doesn't execute - Stack Overflow]

Question owner

All the AJAX handling is done via a "black box" of PEAR. I would have to go in a dig out where to change things. The only reason I can doing it this way is that the generation of the menu is via javascript modules in DHTMLSuite.

I think what you are saying is to create the menu structure on the server side and send that back to the browser to be put in place via innerHTML as already built and not as a script. To do that I would have to go deeply into the inner workings of the DHTMLSuite in order to generate it in php on the server side. Is that what you mean?

All the AJAX handling is done via a "black box" of PEAR. I would have to go in a dig out where to change things. The only reason I can doing it this way is that the generation of the menu is via javascript modules in DHTMLSuite. I think what you are saying is to create the menu structure on the server side and send that back to the browser to be put in place via innerHTML as already built and not as a script. To do that I would have to go deeply into the inner workings of the DHTMLSuite in order to generate it in php on the server side. Is that what you mean?
jscher2000
  • Top 10 Contributor
8684 solutions 70998 answers

I don't know what's best because from where I sit this whole discussion is like inspecting a battleship through the barrel of a ballpoint pen. :(

I don't know why the menu needs to dynamically requested via AJAX at all. Can you avoid doing that and use a simple script src= approach?

I don't think you need to change the plumbing, but perhaps your template suppliers have an update.

I don't know what's best because from where I sit this whole discussion is like inspecting a battleship through the barrel of a ballpoint pen. :( I don't know why the menu needs to dynamically requested via AJAX at all. Can you avoid doing that and use a simple script src= approach? I don't think you need to change the plumbing, but perhaps your template suppliers have an update.