I have developed a responsive ceramic sales site in ASP.NET, jQuery, etc.
On the product page there is a textarea where customers can ask for further
information about the product they are viewing.
Before sending the email, the user must enter a number that appears
in a Captcha image in a textbox. The problem is that when I close
the site (on a mobile browser, only tried Chrome) and then recall the
same page by tapping between the various previously closed
pages in the list, the captcha image does not appear.
I have tried in various ways to update just the image or even
the entire page with AJAX included in the document.visibilityState
directive which I successfully use to scroll through the history, but
the image does not appear. I think I understand that the problem is
that by recalling the tab by tapping on the previews of the closed
pages there must be an event (which I don’t know) that allows you to
update the page or part of it with AJAX.
I don’t know if I made myself clear enough. I wonder: if when I recall the tab the page doesn’t
update automatically, why does the image disappear?
I tried in ($(document).ready) >> window.location.reload();
then also (document.onvisibilitychange)
changing the state from hidden to visible and then using AJAX to update the parts of the page that interest me, or (window.addEventListener("pageshow", function (event) {)
The problem persists because from what I understand when I recall the tab no onload event is activated and therefore no instruction is effective.
2
Answers
I wanted to apologize to all the members of the community and especially to stackoverflow as I solved the problem simply with an ajax call that updates the code when the page opens. In fact the onload event normally occurs when the tab is opened. The problem was that I did the tests with the javascript file of another page. I'm ashamed like a dog....
I apologize again but I didn’t post the code because in effects the answer to my question
it is given in various posts from which I have also used several times.
As I explained due to the fact that I kept editing due to carelessness
the wrong javascript file, having no results, I assumed that those solutions
were not right.
Anyway, calling the preview from the list of various pages previously opened and then closed on the mobile browser, the onload event is activated therefore: