5 Replies Latest reply on Aug 9, 2016 7:40 AM by Pietro Francesco Maggi

    Not allowed to load local resource and signal-metatag

    Moritz Heindl

      Hi,

       

      I'm using the Enterprise Browser 1.4 on a WM 6.5 device. And I've got two problems:

      1.  I encounter following message in the logfile:

       

           I 08/02/2016 15:56:57:000 4cac5a96 RhoWKBrowserEngine.cpp: 693| JS Log: , line 0: Not allowed to load local resource: file://PATH/some.JS

       

           file://PATH/some.JS is a placeholder for a real file.  How can I make the EB "allow" to load local resources or is this not possible.

       

      2.   I try to get a signal-symbol in the EB but the metatag in the config.xml

           <MetaTag value="Signal~left:10;top:10;"/>

           isn't working

       

      Thanks for your help

      Moritz

       

        • Re: Not allowed to load local resource and signal-metatag
          Pietro Francesco Maggi

          Hi Moritz,

          I think that the problem you see is because you're reading the files using the file:// protocol.

           

          Can you try enabling the HTTP server integrated in Enterprise Browser and see if this solve your issue?

           

          you need to enable the option in the Config.xml file:

          <WebServer>
          <Enabled VALUE="1"/>
          <Port VALUE="8082"/>
          <WebFolder VALUE="/www/"/>
          <Public VALUE="0"/>
          </WebServer>

           

          Regarding the "Signal" tag in the Config.xml, you should try to set it as visible:

           

          <MetaTag value="Signal~visibility:visible;"/>

           

          ~Pietro

            • Re: Not allowed to load local resource and signal-metatag
              Moritz Heindl

              Thank you Pietro, the signal is now visible. But I still have the problem with the locally stored data. I'm actually not sure how to set the path correctly and if the port is relevant. The files are stored in a folder in the root directory ( \XX\YY\). The error in the logfile shows:

              Not allowed to load local resource: file:///XX/YY/pic.gif

               

              I tried the following WebFolder Values:

               

              "file:///XX\YY\"

              "file:///XX/YY/"

              "\XX\YY"

              "\XX\YY\"

               

              Moritz

                • Re: Not allowed to load local resource and signal-metatag
                  Pietro Francesco Maggi

                  Hi Moritz,

                  once you activated the http server included in Enterprise Browser, you can then set as start page the localhost on the configured port.

                   

                  So, you can setup in your Config.xml (supposing that your HTML, JavaScript, CSS and images are in the /XX/YY folder on the device, and that the first webpage to show is "index.html":

                  <WebServer>
                  <Enabled VALUE="1"/>
                  <Port VALUE="8082"/>
                  <WebFolder VALUE="/XX/YY"/>
                  <Public VALUE="0"/>
                  </WebServer>
                  
                   <General>
                   <Name value="Menu"/>
                   <StartPage value="http://127.0.0.1:8082/index.html" name="my_app"/>
                   <UseRegularExpressions value="0"/>
                   </General>
                  

                  That's all.

                   

                  From that point on you reference the other file from index.html with relatives path.

                  If the images are in the path /XX/YY/js, you reference it as:

                   

                   

                  <script src="js/app.js"></script>

                   

                   

                  Hope that this makes it a bit more clear :-)

                   

                  Ciao

                  ~Pietro

                    • Re: Not allowed to load local resource and signal-metatag
                      Moritz Heindl

                      Actually that didn't solve the problem, because I wasn't precise enough in describing the problem:

                       

                      We are running a SAP mobile ITS server and we want to load local files from the device to improve the performance. Therefore using Webserver isn't the right thing.

                      I had the same problem with "not allowed..." in the internet explorer 6 mobile and solved it with changing the security zone in the registry. This made also the

                      Enterprise Browser with the IE Engine work with our service but not the EB with the Webkit engine.

                       

                      Is there an entry in the registry for the security options of EB Webkit or another method to allow a website to load locally stored files?

                       

                      Many thanks in advance and sorry for being not precise enough before

                      Moritz

                        • Re: Not allowed to load local resource and signal-metatag
                          Pietro Francesco Maggi

                          Hi Moritz,

                          I don't know of any way to lower the standard security rules of the webkit rendering engine.

                          This behaviour is dictated by W3C standards and there are a couple of ways to work around Cross-Origin Resources:

                          1. CORS
                          2. Application caches

                           

                          CORS is a W3C standard that you can use to asynchronously download resources from different origins: Using CORS - HTML5 Rocks. It is probably a bit overkill for your use case.

                           

                          My suggestion is to investigate HTML5 Application cache, that is supported by our Webkit rendering engine and you can use, adding a manifest to your webpages that states if the files can be cached on the local devices. In this way they're going to be downloaded from the server only once, and you can simply increse the version number of the resource in the Manifest file, when you need to distribute a new version of that resource.

                          You can find an intro on how to use app caches on HTML5 Rocks: A Beginner's Guide to Using the Application Cache - HTML5 Rocks.

                           

                          Just pay attention to setup the correct MIME-Type for the Manifest file:

                          A manifest file must be served with the mime-type text/cache-manifest. You may need to add a custom file type to your web server or .htaccess configuration.

                           

                          Ciao

                          ~Pietro