• Leonid Gauss
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Basics (100)
      7 months ago #43669

      Hello,

      the end users often click on the back and refresh buttons in their browser and in combination with the UI5 architecture of the Simplifier this leads to them leaving the application completely.

      How can you subscribe to a browser refresh button in the Simplifier so that you can intercept this?

      Or blocking the refresh button in the browser would also be good.

      I managed to disable the back arrow in the browser with the screen event “OnBeforeHide”

      Many thanks in advance

      With kind regards

      Leonid Gauss

      Chris Bouveret
          Has successfully completed the online course Introduction
          Has successfully completed the online course Intermediate (200)
          Has successfully completed the online course Advanced (300)
          Has successfully completed the online course Basics (100)
          Has successfully completed the online course Advanced (320)
          Has successfully completed the Intermediate Certification
          Has successfully completed the Advanced Certification
        7 months ago #43690
        Up
        1
        Down
        ::

        Hi Leonid,

        please have a look at this example:

        https://demo.simplifier.io/appDirect/RefreshDemo/index.html?sap-ui-debug=RefreshDemo

        I subscribed to the onBeforeFirstShow Event and added a script block with the following code:

        window.onbeforeunload = function() {
          return "Data will be lost if you leave the page, are you sure?";
        };
        • This reply was modified 7 months ago by Chris Bouveret.
        Attachments:
        You must be logged in to view attached files.
        Chris Bouveret
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (320)
            Has successfully completed the Intermediate Certification
            Has successfully completed the Advanced Certification
          7 months ago #43674
          Up
          0
          Down
          ::

          Hi Leonid,

          Simply put, it is impossible to avoid Page reload if the User clicks the ‘Refresh’ button on the browser. There is no way to avoid it if the user wants to refresh the page. But this could be intercepted as described in this StackOverflow post, you can use window.onbeforeunload to detect refresh (either F5, CTRL+R or the browser’s button). Usually this can be used to trigger a dialog for the user where a confirmation is asked to referesh the page

          Hope this helps

          Leonid Gauss
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Basics (100)
            7 months ago #43689
            Up
            0
            Down
            ::

            Thank you very much for your answer Christopher,

            of course I googled and found something similar in Stackoverflow before I asked my question here, I know how to create custom events in Simplifier and trigger them, but as far as I know you can only apply them to the buttons that are available in my application. How do I get the refresh button from the browser into my application with Simplifier?

            Thanks in advance,

            Greetings Leonid

            Leonid Gauss
                Has successfully completed the online course Intermediate (200)
                Has successfully completed the online course Basics (100)
              7 months ago #43697
              Up
              0
              Down
              ::

              Thank you very much Christopher, it is works in my application!

              Greeting Leonid

            Viewing 5 posts - 1 through 5 (of 5 total)

            You must be logged in to reply to this topic.