Refresh A Browser Widget.

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Refresh A Browser Widget.

Post by Googie85 » Wed May 25, 2022 8:24 am

Hi LiveCoders!

I am having a problem refreshing a webpage "TEST.html" in a browser widget. The html page displays an image "/1.jpg" , and this displays fine.

I am updating the /1.jpg file, but, the webpage "TEST.html" does not refresh to the newly updated "/1.jpg". I am trying to refresh the page so it will display the updated image file.

I hope I have explained my situation clearly!!

Any help is greatly appreciated!!

Thanks,

Googie.

EDIT: I am using the following code to send to the browser widget.

Code: Select all

   put ( specialFolderPath("documents") & slash & "TEST.html" ) into blah
   set the URL of widget "Browser" to blah

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Refresh A Browser Widget.

Post by richmond62 » Wed May 25, 2022 8:56 am

Why do I have a feeling that inserting a dummy HTML file between each refresh might make
all the difference?

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Mon Jul 31, 2006 1:39 am
Location: New Zealand, Australia, Germany, Japan
Contact:

Re: Refresh A Browser Widget.

Post by strongbow » Thu May 26, 2022 6:18 am

Probably because blah doesn't contain a URL.

You need to prepend something like "file:" to your variable "blah".

mrcoollion
Posts: 719
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Refresh A Browser Widget.

Post by mrcoollion » Sun Mar 05, 2023 12:24 pm

Just a small addition to this topic beause i am working on this 'issue'.

If you just want to refresh the browser widget using the url already set you could use the following.

Code: Select all

On Mouseup
   RefreshBrowser "Name"
end Mouseup

command RefreshBrowser BrowserWidgetName
   put the url of widget BrowserWidgetName into tBrowserUrl
   set the URL of widget BrowserWidgetName to tBrowserUrl
end RefreshBrowser
Regards,

Paul

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Refresh A Browser Widget.

Post by FourthWorld » Sun Mar 05, 2023 6:38 pm

Browser engines are notorious for aggressive caching. I recently came across an annoying situation with a web app I've been working on where the layout didn't line up because even though the browser was getting the latest HTML it was still using a cache of an image file that had changed.

One way to prevent that is to modify the image URL by appending the src reference with a bogus query that's different each time the page is loaded:

https://instructobit.com/tutorial/119/F ... Javascript
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Android Deployment”