how to prevent users to use browser navigation - Forum

Forum Navigation
Climate strike banner
You need to log in to create posts and topics.

how to prevent users to use browser navigation

I would like to ban users to go back with browser navigation button to the previous state. Is it possible? (so they should not be able to change their choice to another one in a questionnarie.)

@info1:

ban users to go back with browser navigation button to the previous state

When you say "state", I assume that you are talking about "page in your App created with VisualNEOWeb".

they should not be able to change their choice to another one in a questionnarie

Again, I assume you have "one question per page".

1) Each page has a page-enter and page-exit event section, where you can ...

- set up your own "variables/arrays" to keep a list of previously visited "question pages"

- use one of the navigation commands here (https://webhelp.visualneo.com/Navigation.html) to redirect a user attempting to "re-navigate to a previously visited page" to another page.

 

2) Another (somewhat simpler) tactic would be to have a Text Box (that covers the entire page; optionally with some kind of "Not Allowed" message) that is normally hidden, but upon page-exit you apply ...

ShowObject

ObjectToFront

 

3) Finally, you might consider using just one page for all your questions ... each question/answer set set can be placed in a separate  "off screen and hidden" container ... then just show/move one container into place as needed.

 

Dear Gaev,

Thanks for your reply!

Actually there is a "yes" and "no" button. When user pushes one of them, the other will be disabled, and the correct answer will appear. Then user can push a "Next" button to go to the next question. If the answer was wrong, user should start from the beginning.

Here it is (in Hungarian)

http://www.e-tankonyvek.hu/kozvetlen-koltseg

Tovább = Next

checkbox page: right answers: 1, 3, 7.

First "individual" Q: Nem (No)

Second "individual" Q: Nem (No)


If user pushes the wrong button, and uses the browser "Back" (s)he can correct the answer without starting from the beginning.

 

Peter

@info1:

I think this should work ...

Actually there is a "yes" and "no" button. When user pushes one of them, the other will be disabled, and the correct answer will appear.

At this stage, populate variable called [nextPermittedPageName] ... which will be the name of the ...

  •  next page (correct answer)
  •  first page (wrong answer).

Then user can push a "Next" button to go to the next question. If the answer was wrong, user should start from the beginning.

The click event section of the Next button should include ...

GotoPage "[nextPermittedPage]

If user pushes the wrong button, and uses the browser "Back" (s)he can correct the answer without starting from the beginning.

In the page-enter event section of each of the pages insert ...

If "[NAB.PageID]" "!=" "[nextPermittedPage]"
   GoToPage "[nextPermittedPage]"
EndIf

Try it out and let us know your experience.

BTW, when I ran your app in Chrome, it automatically translated the contents of the pages into English.

 

Thanks!

It works! You can check it. And user cannot leave the page as well if (s)he edits the url. :-)

First page PageEnter code: SetVar [nextPermittedPage] "", this way user can "restart".

Thanks a lot.

(But during debugging, sometimes it showed error, but next run showed no error or error somewhere else... So error happened randomly.)