Atozed Forums
New interesting demo available - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: New interesting demo available (/thread-2759.html)

Pages: 1 2 3


New interesting demo available - Alexandre Machado - 06-11-2022

Hi guys,

Recently I've been asked on how to enable the back button in an IntraWeb app and have it working as it was an HTML web site. I came up with this demo that I've just published showing  how to accomplish that (it requires some bits released on IW 15.2.57):

https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/MultiPageApp

Key points:

- The application works as a Multi-page application, MPA (opposed to SPA, Single Page Application). MPA have multiple URLs (e.g http://yourdomain/newcustomer http://yourdomain/checkout, etc). On the contrary, traditional SPAs have a single URL

- One key difference between MPA and SPA is how they respond to the back button. In general, hitting the back button when in a SPA application will take you to another page, outside the scope of the application. On the other hand, MPAs respond correctly to back and forward buttons and will take you to the previous or next page in the browser history, inside the application scope. Also, URLs of a MPA app can be bookmarked

- This application makes use of content handlers to handle the URL addresses of the application. Each form has its own URL.

- There is no special code required other than the creation of the content handlers and setting a single property in the ServerController

- Everything should just work as expected. Have a look at the comments in the source code as it contains some important information on how to switch between forms and how to create the content handlers

Enjoy!  Big Grin


RE: New interesting demo available - jeroen.rottink - 06-13-2022

Hi Alexandre,

Running your demo (using Chrome 102.0.5005.115) I see the following

* Start the application. F9 to start a browser session
* MainForm is shown. Press button [Go to SecondForm]
* SecondForm is shown with correct url. Now press the browser back button.
* MainForm is shown. But now again press button [Go to SecondForm]
* The SecondForm is NOT shown. I have to press the button [Go to SecondForm] for a second time to show the SecondForm


RE: New interesting demo available - Alexandre Machado - 06-13-2022

(06-13-2022, 05:35 PM)jeroen.rottink Wrote: Hi Alexandre,

Running your demo (using Chrome 102.0.5005.115) I see the following

* Start the application. F9 to start a browser session
* MainForm is shown. Press button [Go to SecondForm]
* SecondForm is shown with correct url. Now press the browser back button.
* MainForm is shown. But now again press button [Go to SecondForm]
* The SecondForm is NOT shown. I have to press the button [Go to SecondForm] for a second time to show the SecondForm


Jeroen, It works perfectly for me in all tested browsers.
I'm assuming you are not on IW 15.2.57, is that correct? As is mentioned on the demo application's main form, it needs a few bits introduced in version 15.2.57.


RE: New interesting demo available - jeroen.rottink - 06-14-2022

Hi Alexandre,

No, I used IW15.2.57 
Attached is a screen recording showing the issue.


RE: New interesting demo available - MJS@mjs.us - 06-14-2022

I get the same results as Jeroen with Chrome and Edge. For me on startup it works correctly the first time but fails on subsequent attempts (first click nothing, second click shows SecondForm).


RE: New interesting demo available - Alexandre Machado - 06-15-2022

Something is fishy... I got different results. I'll check what's happening and will get back to you guys


RE: New interesting demo available - MJS@mjs.us - 06-15-2022

Something to note - while testing using DevTools (F12) in Edge:  if 'Disable Cache' is enabled the demo works correctly 100% of the time, if 'Disable Cache' is disabled the extra click behavior is reproducible.

[Image: clip0001.png] 


RE: New interesting demo available - jeroen.rottink - 06-15-2022

Hi Mark (according to mjs.us Smile),

Good debugging!

I see the same: If Chrome or Edge Devtools is open AND Network | Disable cache is checked, the browsers back button works as expected.
If I close DevTools or uncheck Network | Disable cache then the problem is as described.


RE: New interesting demo available - MJS@mjs.us - 06-15-2022

>>Good debugging!

It's a necessary skill for me, sometimes I create a lot of bugs.


RE: New interesting demo available - MJS@mjs.us - 06-16-2022

Setting PostRedirectGet = prgEnabled in the ServerController seems to make it work for me under all circumstances.