html help sought

Here we can discuss about the problem found
Post Reply
Stuart
Posts: 126
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 5 times
Been thanked: 20 times

html help sought

Post by Stuart »

I have written much code in my time but can't be an expert at everything. I have now foundered on what is probably a simple matter for some.

I have some buttons on an Annex web page that change things. When they change, htmleventbutton$ tells me what has been pressed. I use that to modify some text and then want the web page to update some text to reflect the new reality. But repainting the screen doesn't do it, it still shows the old text even though the actual text is different, presumably because it is taking an earlier version from the browser cache. I have to do a refresh (F5) to get the updated screen, which does work.

How do I (in a very simple way) force the update to actually happen? i.e. make the f5 happen from within the paint code.

I'm sure (hope) this is very simple but all I can find are massively complex ways that some say work and some say don't.

Stuart
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: html help sought

Post by cicciocb »

Hi Stuart,
to refresh the page only a simple javascript command is required

Code: [Local Link Removed for Guests]

jscall "location.reload();"

Code: [Local Link Removed for Guests]

' refresh the page "equivalent of F5"
onhtmlreload myrefresh
gosub myrefresh
wait

myrefresh:
cls
a$ = ""
a$ = a$ + "First Line<br>"
a$ = a$ + "Second Line<br>"
a$ = a$ + "Third Line<br>"
a$ = a$ + "Random " + str$(rnd(1000))
html a$
pause 1000
jscall "location.reload();" ' refresh the page
return
Stuart
Posts: 126
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 5 times
Been thanked: 20 times

Re: html help sought

Post by Stuart »

Thanks for that. I had found the command but wasn't sure how to use it. There are so many overcomplicated solutions out there.
Post Reply