9 Replies Latest reply on Dec 20, 2011 12:13 AM by Darryn Campbell

    Problems with Javascript

    Jason Beneteau

      I am using the Alpha 5 Framework and trying to develop an few pages for a proof of concept that will work on a MC9190. I made a page in Alpha 5 that has an inventory search which uses ajax callbacks to load the data to the page. It works in my Android webkit browser but the javascript crashes in Rho Elements. How do I find what lines of Javascript code are crashing it? Is there a debug mode?

       

      Edit: I found the debug mode and this is the error that I am receiving when I try to perform an ajax callback using my framework. Any idea where to look for further details?

      ERROR: Engine ConsoleLog Error: Error calling method on NPObject., line 0: undefined  0 2009-01-02 22:26:55
      
        • Re: Problems with Javascript
          Robert Galvin

          Hi Jason

           

          Are you trying to run these from the local file system or from a remote web server. If it is the local files system, the security settings for AJAX does not allow this, luckily we have addressed this in the latest release by including a built in web server.

           

          By default the local web server is switched off, you will need to manually enable and configure the server using the RhoElements configuration file. See the Configuration Settings help page for the server options, specifically those under the <WebServer> hierarchy.

          Using the following example configuration:

          • Enabled: 1
          • Port: 8080
          • WebFolder: \myWeb
          • Public: 0

           

          Navigating to file://\myWeb\index.htm will load the page from the file system.

          Navigating to http://localhost:8080/index.htm will load the same page via the local web server.

           

          This should resolve your ajax problem. If you want to also post a sample along with the Config.xml file, I can take a look.

            • Re: Problems with Javascript
              Jason Beneteau

              Thank you for your reply,

               

              I am running the page on a remote web server. I made an icon like in the youtube video, "RhoElements path..." /S:xxx.xxx.xxx.xxx/test.a5w . where xxx is the IP address of my webserver. When I google NPObject errors all I see is security and cross domain problems with Flash/Silverlight/Java. I don't have any plugins just HTML, CSS, Javascript.

            • Re: Problems with Javascript
              Jason Beneteau

              I'm still trying to figure this out but I cannot get past the error on NPObject. Does this have to do with security in Rho Elements?

              • Re: Problems with Javascript
                Robert Galvin

                Jason

                 

                I think you may have had the slashes going the wrong way in your .LNK file.

                 

                Here is a shortcut file I created to launch a demo Alpha5 app on their site:

                87#"\Program Files\RhoElements\RhoElements.exe" /S:http://demo.alphasoftware.com/grids.a5w
                

                 

                You may also want to change the config.xml so that you can actually type in an address in a address bar to make sure you have the URL correct:

                <DebugButtonsEnabled value="1" />
                
                • Re: Problems with Javascript
                  Robert Galvin

                  Hi Jason

                   

                  I think I know what is going on here. Within the a5.js script it has the following line.

                   

                  getTransport:function(){if(window.ActiveXObject)returnnewActiveXObject('Microsoft.XMLHTTP');elseif(window.XMLHttpRequest)returnnewXMLHttpRequest();else return false;} 
                  

                   

                  Because we have implemented the ActiveXObject for backward compatibility with PocketBrowser, It tries to create a 'Microsoft.XMLHTTP' ActiveX object and it can't. You really want it to execute the

                  newXMLHttpRequest().

                   

                   

                  To work around this rename the npwtg_legacy.dll (found in \program files\rhoelements\NPAPI) to something not ending in .DLL. This will effectively not load this library when RhoElements starts up. Or Change the line to check for window.XMLHttpRequest first. The later may be better if you are trying to run on Et1. As ET1 is Android, you don;t have access to the NPAPI folder to remove the npWTG_legacy.dll

                   

                    • Re: Problems with Javascript
                      Jason Beneteau

                      Rob,

                       

                      Thanks for figuring it out. My Ajax works beautifully now. Do you think it is possible to add a switch to the Rho Elements config to turn off legacy code?

                        • Re: Problems with Javascript
                          Darryn Campbell

                          You can set all the <PreloadLegacyXXX> values to 0 in the configuration file.  You must set them all to 0, we have a known issue where setting them individually will not work.  So you have:

                          <Preloads>

                                    <PreloadLegacyGeneric VALUE="0"/>

                                    <PreloadLegacyODAX    VALUE="0"/>

                                    <PreloadLegacyNoSIP   VALUE="0"/>

                                    <PreloadLegacyAirBeam VALUE="0"/>

                                    <PreloadLegacyAPD     VALUE="0"/>

                                    <PreloadJSObjects     VALUE="1"/>

                                  </Preloads>

                          1 of 1 people found this helpful