Webpage - To Close or Not Close

Are there any best practices regarding closing a Webpage or not closing?

In general I assumed I should close to save resources (at least memory) but I am not so sure that I should always do a Webpage.Close.

Thoughts?

Greg explained not long ago that if you have your WebPages as implicit instance, they are in fact all loaded at the start of the program. So closing them after display won’t save much memory. Also, pages already loaded will probably display faster.

If you do not have implicit instance on, then indeed, closing them will save memory.

That said, when you have several GB available, saving memory may be less important than displaying faster.

Remember though, that just because you don’t close a WebPage does not mean that a clever user can’t access the contents. With all of the development tools out there, a user could make any page visible at any time.

Browsers tend to have a “per-page” limit though. It varies from browser to btowser and periodically get increased, but the mobile devices are the most restrictive, at around 50MB.

Michel and Greg,

Server memory is usually not a concern but display speed and page change speed is. Creating an app that has large pages would be a concern for browser memory because of transfer time. Having a page with even 10-15 MB seems VERY large to me.

Question1 - How can I tell the size of the page? I can see the contents of the various components of a page with in Safari with Show Page Source and Show Page Resources but getting the total size seems not so easy.

Question2 - So if I close a page can a hacker “trick” it to be redisplayed?

Question3 - If you leave it open does it or any parts stay in browser memory when I change pages?

Question4 - If you have multiple controls built with the WebSDK loaded into the Xojo project it appears that maybe those controls (that have significant JavaScript content) get loaded to the browser even if you do not use them on any pages. True?

All of this has come about for me because of a fairly complex Web App that is a testing engine running as a CGI app. Some questions contain up to 13 possible answers (checkboxes) on each question with one question per page. The same page is “reused” for each question without a new SHOW. It is built with the max number of checkboxes possible and I hide the ones not used and reset the caption on each checkbox. I move the Next/Previous question buttons up on the page to appear just below the last question. When there are more than 6-7 concurrent users the app seems sluggish. Each question has some server side processing for checking an answer and major processing to save your answer and display the next group of answers.

I am using a group of 3rd party controls built with the WebSDK that has lots of controls I don’t use on any page in the project. My typical method to start a new project was to add all of the controls to the project but use only a few. When I decided to delete all of the un-used controls from the Xojo project the page load speed seemed visibly much better.

Thanks for any insights.

A large WebListBox and many pictures can do it.

Is that critical ? Not always.

Michel,

You are correct that a big listbox might consume lots of browser memory but I don’t encounter the need for that very often.

I also suppose that Xojo is generally more secure that most development tools and again for me I am not doing things that need extraordinary security.

BUT … if there are techniques to speed up a Web App it would be nice. If I could avoid loading stuff in a page that was not needed it would be useful. (My Question #4 above)

You are right, the leaner the page the better. Don’t keep control off view or invisible if you don’t intend to use them.

Likewise, when possible, avoid using pictures dragged into the project, to prefer them URLs which display way faster.