0

Disable browser back button

asked 2014-10-16 22:47:57 +0800

rex gravatar image rex
120 2

updated 2014-10-17 07:22:38 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi all,

I have been trying to use the Bookmark event to capture user pressing browser back button, unsuccessfully. How can I capture the event of user pressing the back button? My page structure is that I have a zul file called desktop.zul that contains the entire application. desktop.zul has a GenericForwardComposer and I am trying to catch the bookmark event by doing the below code.

I would appreciate some pointers.

public void onCreate(Event event) {

        final Desktop desktop = Executions.getCurrent().getDesktop();
        desktop.setBookmark("mainDesktop");
        desktopPage = desktop.getPage("desktopPage");

        desktopPage.addEventListener("onBookmarkChange", new EventListener() { 
            public void onEvent(Event event) throws UiException { 

                System.out.println(">>>>>>>>>>>>>>>event=" + event);
                BookmarkEvent bme = (BookmarkEvent)event;
                String bookmark = bme.getBookmark();
                System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>Bookmark=" + bookmark);
            }   
            });
delete flag offensive retag edit

Comments

Thanks for this. It was usefull for me to :)

czoki ( 2014-10-21 10:53:21 +0800 )edit

works here ;D :D thanks a lot for that :D

hardstro ( 2014-10-21 11:57:45 +0800 )edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-17 07:24:34 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Its not possible to disable browser back button rather than you can remove current document from the browser like some secure site did that see banks site .

link publish delete flag offensive edit
0

answered 2014-10-17 08:46:16 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

You could try this :

http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911

As @Sjoshi said, It's impossible to disable it but there are some tricks you could apply.

Greetz chill.

link publish delete flag offensive edit
0

answered 2014-10-17 16:41:51 +0800

rex gravatar image rex
120 2

Thanks for the responses, disabling might be the wrong work how do I capture the "history.back()" event?

@chillworld: How do I incorporate those javascript in the link in my Zkoss desktop page?

Appreciate all the pointers.

link publish delete flag offensive edit
0

answered 2014-10-21 15:20:51 +0800

dis gravatar image dis flag of Switzerland
140 4

It is very simple with ZK Clients class:

Clients.confirmClose("your message");

Dieter

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-10-16 22:47:57 +0800

Seen: 49 times

Last updated: Oct 21 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More