Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Back button on Safari

Orapan Sanghirunyaplute
6 years ago Mar 09, 2016 3:37am

Hi,

I have a home UI that can click to open search window. After do search and results displayed in the tree table, we can double click on the result to open a new url [Page.getCurrent().open(url, newWindow ? "_blank" : "_self")], which is another UI module. It works fine until we click back button on browser, it will display the previous page with the same things before we left (such as search window with old search result). However, that page is not responsive. Whatever we click or try to do, the page is not responding. I can reproduce this problem on Safari but not on Firefox and Chrome. I also found out that if I disable caches in Safari or reload the page, it will fix the issue but they're not practical solutions here. I'd like something to do with the code. Here is the list I've already tried and none of them works:

1. In the search window, before Page.getCurrent().open(...), I put the following two lines. I saw it closed the search window and reload the page but not open a new url.
Ui.getCurrent().removeWindow(this);       // also already tried this.close()
Page.getCurrent().reload();

2. Use @PreserveOnRefresh on home UI class.

3. Implement UriFragementChangedListener in home UI class.
    getPage().addUriFragmentChangedListener(new UriFragmentChangedListener() 
    {
        @Override
        public void uriFragmentChanged(UriFragmentChangedEvent source) 
        {
            log.info("Test: CATCH Fragment changed...");
        }
    });

4. Include Http Servlet Filter JAR in the project (Apache2 licensed Cache-Filter)

Any suggestions please?

Liang ZHANG
6 years ago Mar 09, 2016 10:05am