Web: Webpage stays in memory even when you use .close?

In the Xojo WebEdition 2015.4 I have 2 Pages:

Page1 and Page2

On Page 1 I have a Button “go to page 2”.
On Page 2 I have a Button “back to page1”.

When I press the Button on page 1, I have this Action behind the Button:

Page2.show
self.close

And the back - Button on Page2 have as Action:

Page1.show
self.close

Then I see old content on Page1.

How can I get a fresh page1?
Is there something wrong with my closing of the page?

Should I use Page1.close instead of self.close?

Should I close the Page1 in the Shown event of Page2?

I don’t know what I making wrong?

If you want a fresh copy, you have to create it in code… Like this:

dim wp as new WebPage1 wp.show

Even when I close it?

I prefer to have WebPage.ImplicitInstance set to false. This forces me to either reuse the page already in memory, or create a new instance.

ImplicitInstance set to true often leads to some bizarre behavior - especially for those to new to Xojo programming.

Good idea, I made the ImplicitInstance off, and using Greg O’Lone 's way of creating a new WebPage.

But again I see the old page, when I .close it, and open it with

dim wp as new WebPage1
wp.show

again. There ist something, that the .close isn’t 100% close.

Update: I found the Blog Entry from Bob Keeney:
http://www.bkeeneybriefs.com/2016/01/implicitinstance-is-evil/#comments

And I try from the next WebPage:

for i as integer = 0 to Session.PageCount-1

dim w as WebPage = Session.PageAtIndex(i)

if w isa Page1 then
  
  MsgBox ("Is not closed!")
  
end

next

That MsgBox is not fired. So, the close works. But something went wrong bei Open the Page1 again.


[At Bob: Small tipp: In your Blog you wrote if w is a WebPage1 then , you have to change it to: if w isa WebPage1 then ] :slight_smile: