Webviewer local url

Hi, I am using a webviewer to get a local web page, the web page and the images have been downloaded to the the same folder but when I call gotourl the webpage shows but does not display the images, can anyone please tell me what I am missing
here is the html code.

> <html>
> <head>
>     <style>
>         .container{
>             position:relative;
>             width:100%;
>             height:85px;
>             border-radius:5px;
>             border:1px solid red;
>             overflow:hidden;
>             background-repeat: no-repeat;
>         }
>     </style>
> </head>
> <body>
> <div id="imgGallary" class="container">
>     <img src="Advertise_Here.gif" alt="" width="100%"  height:85px; />
>     <img src="bmcsmaller1.gif" alt="" width="100%"  height:85px; />
>     <img src="GreenandOrange.gif" alt="" width="100%"  height:85px; />
>     <img src="PinkandWhite.gif" alt="" width="100%"  height:85px; />
>     <img src="TealandWhite.gif" alt="" width="100%"  height:85px; />
> </div>
> <script>
> (function(){
>         var imgLen = document.getElementById('imgGallary');
>         var images = imgLen.getElementsByTagName('img');
>         var counter = 1;
> 
>         if(counter <= images.length){
>             setInterval(function(){
>                 images[0].src = images[counter].src;
>                 console.log(images[counter].src);
>                 counter++;
> 
>                 if(counter === images.length){
>                     counter = 1;
>                 }
>             },15000);
>         }
> })();
> </script>
> </body>
> </html>

Tested and working, using companion:

BLOCKS

image

HTML (edited for testing purposes)

 <html>
 <head>
     <style>
         .container{
             position:relative;
             width:100px;
             height:85px;
             border-radius:5px;
             border:1px solid red;
             overflow:hidden;
             background-repeat: no-repeat;
         }
     </style>
 </head>
 <body>
 <div id="imgGallery" class="container">
     <img src="firebaselogo.png" alt="" width=100px/>
     <img src="sheets.png" alt="" width=100px />
     <img src="hport.jpg" alt="" width=100px />
     
 </div>
 <script>
         var imgLen = document.getElementById('imgGallery');
         var images = imgLen.getElementsByTagName('img');
         var counter = 1;
 
         if(counter <= images.length){
             setInterval(function(){
                 images[0].src = images[counter].src;
                 console.log(images[counter].src);
                 counter++;
 
                 if(counter === images.length){
                     counter = 1;
                 }
             },3000);
         }
  </script>
 </body>
 </html>

SCREEN
image

Unless you have more planned, you do not necessarily need the function part in your script.

Check your file paths, and confirm your images are in the same directory as your html file, and that you have read permissions.

1 Like

Thank you for your reply, I can't get it to work, the image files are in the same folder, I checked with a file manager, I am not calling http:// to a localhost I am using file:// when I parse the html and insert the absolute paths of the images it works ???

  1. Show your file path to your HTML file.
  2. Which Android version?
  3. Development / Compiled / Both ?

first I saved a file using Sunny's Efile, afterFileSaved I use get fileName and strip the filename leaving me the path, this is saved to a tinyDB. Using this path and the filename of the downloaded html I used the gotoUrl joining the filepath and the filename and using file:// on my webviewer. All of the image files are in the same folder as the html file.
Android 10, just development I haven't compiled it

WebView needs file access permission to load files except from assets.So you should try:

ok thanks I will try it

You didn't answer, so I will guess, are you saving to your ASD, or a folder in your ASD, or to somewhere else?

sorry I am still working on this the customwebviewer needs to be set before you can gotoUrl I just found this out and at the moment it is throwing net:: ERR_ACCESS_DENIED when I try to ccess the downloaded html

You need to set FileAccess property to true.Also you need to have Read External Storage permission.
However, you can't access files outside of ASD in Android 10 and above versions.

thanks Sunny that did the trick

yes everything was in the files folder for ai2. I just set the fileAccess re [vknow360] and then I tried a standard webviewer and lo and behold they both worked ??? I don't know now what I did, but thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.