Page 1 of 1

html help sought

Posted: Tue May 04, 2021 7:42 pm
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

Re: html help sought

Posted: Tue May 04, 2021 8:33 pm
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

Re: html help sought

Posted: Wed May 05, 2021 6:30 am
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.