Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Back Button control
#1
I have recently upgraded from IW12 to 15 in Delphi 2010, and have sadly lost a brilliant piece of functionality - I have the following bit of JavaScript included in the header of each of my pages (using the ExtraHeader property) to prevent people from using the back button

<script type="text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>


It wasn't *perfect*, as it could be bypassed with sufficient user investment, but it was pretty damned handy, and worked in every browser we tried it with. Unfortunately, after upgrading to IW15, the code is still appearing in the page headers but it doesn't appear to work at all. The built-in replacement from Intraweb (BackButtonOptions,mode = bmInterceptGlobal) sadly doesn't seem to be functional either in Chrome or Edge, although it is at least working in IE.

Does anyone have any idea why the above script would have stopped working between versions?
Reply
#2
Can you test in Chrome? Once the page is loaded press ctrl-shift-j and look at the errors tab. Do you see any errors listed?
Reply
#3
Hi Kudzu,

I've set the BackButton options in my program as well, and it is true that where it works in IE (the user do get the message I defined and the browser stays on the page), it does not work in Edge, chrome or Firefox. In those 3 the message is not shown, and the browser tries to get to the previous page.

I have tried in Edge to press CTRL+SHIFT+j after selecting a subpage (before pressing the back button), and it shows 3 HTML errors:

HTML1300: Navigation occurred
HTML1512: Unmatched end-tag
HTML1514: Extra body tag found. Only one body tag should exist per document

NB! I do not have any code in the Extraheader property.

Regards
Soren
Reply
#4
Are you using a template? Do you see these errors if you run the simple Guess demo?
Reply
#5
Hi Kudzu,

The Guess program do not open other pages and therefore do not show a back button. I have tried NewWindowDemo instead, opening a new window with the IW manual PDF file.

And added InterceptGlobal, yes to Showmessage and a simple text in Warningmessage.

Trying IE: it do block and show my message. CTRL+SHIFT+j do not work (or at least do not show anything), so using the menu to open devtools, and Consol, and it do show the same 3 HTML errorcodes. However, IE11 also show HTML7011, between 1300 and 1512. 7011 says: the Code on this page has deactivated cachestorage forward and backward.

Trying EDGE: Do not intercept and tries to go back. Show the 3 previous HTML messages when opening DevTools (ctrl+shift+j)

Trying Chrome: Do not intercept the back button and try to go back. Do not show ANY messages in Console with ctrl-shift+j

Trying Cliqz (the version of Firefox I use) at it do intercept and give same message as IE11. Ctrl+Shift+j on the other hand, do open a devtool console, but wit another error: Uncaught exception. Key event not available n some keyboard layouts.

Regards
Soren

and no, I do not use a template.

Sorry, I did not try the ctrl+shift+j on the guess program, but I just did and:

IE: no info whatsoever in the DevTools. It's like IE do not react to ctrl+shift+j.
Chrome: open deltool windows, but without any text.
Edge: Do open the Devtools, and show HTML1300 but not 1512 and 1514
Firefox: do show the devtool window, and show the same message uncaught exception.

Regards
Soren
Reply
#6
post-weekend update : Setting the PostRedirectGet to prgEnables seemed to fix the built-in functionality for us - I also had to remove the "Users can start multiple independent sessions in browser tabs" option in the wizard, and re-enabe CookieOptions.UseCookies.

This has allowed me to remove the javascript I was entering on each page.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)