Isnât there anyone?
hey whats ur problem. just say
I click on the elements in ListView1 to move to an element in the second ListView, and from there I send a URL to the WebViewer based on the index, but the ListViewer resets the index.
Ok i will see this.
show your blocks
test.aia (534.4 KB)
What do u mean by index reset?
First save the get start value in var. . then use it
When I make a selection in ListView2, the same URL always opens in the WebViewer."
In the listview2 picked u should set the list index of listview1.selection index.u set both of listview2 selection and selection index
I have HTML files hosted on my server, which I load using WebViewer. In cases where there is a server-related issue and the HTML file cannot be loaded, I want to prevent the URL of my website from being displayed. How can I achieve this? Iâve attached an image showing an example of the HTML file failing to load.
Try a Screen.ErrorOccurred event
Taufun
Steps to Prevent URL Display on Load Failure
1. Use a Splash Screen or Loader First
- Before loading the WebViewer, show a loading screen or a spinner.
- Only make the WebViewer visible if the content loads successfully.
2. Check If URL Can Be Loaded
- Use the âWebâ component in Kodular to make a quick HEAD request (or GET) to check if the HTML file is available before passing the URL to the WebViewer.
Blocks:
[Web.Url] â "https://yourdomain.com/yourfile.html"
[Web.Get]
Then use the Web.GotText
or Web.GotResponseCode
to check status:
When Web.GotText
if Web.ResponseCode = 200 then
set WebViewer.Url to "https://yourdomain.com/yourfile.html"
set WebViewer.Visible to true
else
show error message or fallback page
3. Use Local HTML File as Fallback
If the online HTML canât be loaded, show a local HTML file (e.g., from assets) like this:
set WebViewer.Url to "file:///android_asset/error.html"
4. Handle WebViewer Errors Gracefully
Use WebViewer.ErrorOccurred
block:
When WebViewer.ErrorOccurred
set WebViewer.Visible to false
show notifier with custom error
If helpful mark as solution
If there is no connection, the WebViewer doesnât open â Iâve managed to fix that, thank you. In your solution, only a single URL is being checked. I have 30 URL addresses; should I turn them into a list and check them that way?
then use network block from kodularâŚ
during screen init, use one if then else logic as
if is network connected
then // use blocks for true
else // use blocks for false
Yes, exactly! If you have 30 URLs, the best approach is to:
Store All URLs in a List and Check Them Sequentially
You can use a list of URLs, and then check them one-by-one using a loop with the Web component. Hereâs a simplified flow:
Kodular Logic (Overview)
- Create a List of URLs
[Global urlList] = ["https://example.com/page1.html", ..., "https://example.com/page30.html"]
- Use an Index Variable
Keep track of the current index youâre checking:
[Global urlIndex] = 1
- Check URLs Sequentially
Procedure CheckNextURL:
if urlIndex ⤠length of urlList then
set Web.Url to select item from list urlList at index urlIndex
call Web.Get
else
show error: "No working URLs found"
- Handle Web.GotText or ResponseCode
When Web.GotText:
if Web.ResponseCode = 200 then
set WebViewer.Url to select item from urlList at urlIndex
set WebViewer.Visible to true
else
increment urlIndex by 1
call CheckNextURL
- Start the Check on Screen Initialize or Button Click
When Screen1.Initialize:
call CheckNextURL