Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep linking not working with Vaadin 8 and IE11 #9567

Closed
vgoehrke opened this issue Jun 22, 2017 · 4 comments
Closed

Deep linking not working with Vaadin 8 and IE11 #9567

vgoehrke opened this issue Jun 22, 2017 · 4 comments
Labels
Stale Stale bot label

Comments

@vgoehrke
Copy link

Hi,

i’m having a problem with Vaadin 8.0.6 and navigation. In my application, there are links and buttons, which the user might click to navigate through my application. The link contains an url and the button has a click handler, setting an uri fragment. Both controls are navigating to different views and are always visible.

Using IE11 (11.0.9600.16428 RTM) the navigation fails under specific circumstances. When I click the link in the browser, the browser displays a view. Then I click the button and the other view is displayed. Clicking the link again, the browser displays the url of the first view, but it gets never displayed. I did not receive an url change in the application, by using the PopStateListener nor the UriFragmentChangeHandler. Even the VaadinServlet.service method is not called.

Using Chrome 58.0.3029.110 or Firefox 54.0, my application works like a charm. Vaadin 8.0.5 had the same problem, Vaadin 7.7.7 worked. Switching from setting the uri fragment to using the Navigator for navigating the views, did not change the behavior.

What am I doing wrong? Any hints are appreciated.

I have reproduced the problem, by creating a Vaadin project in eclipse and changing the UI class, as followed.

Volker.

@Theme("mytheme")
public class MyUI extends UI {

	@Override
	protected void init(VaadinRequest vaadinRequest) {
		getPage().addPopStateListener(event -> refresh());
		refresh();
	}

	private void refresh() {
		try {
			final VerticalLayout layout = new VerticalLayout();
			
			String uriFragment = Optional.ofNullable(getPage().getUriFragment()).orElse("");
			Label fragmentLabel = new Label("The current uri fragment is: " + uriFragment);
			layout.addComponent(fragmentLabel);
			
			Link hereLink = new Link("Link to here.", getNewFragmentResource("/here"));
			layout.addComponent(hereLink);
	
			Button thereButton = new Button("Change to there");
			thereButton.addClickListener( event -> {
				getPage().setUriFragment("/there");
				refresh();
			});
			
			layout.addComponents(fragmentLabel, hereLink, thereButton);
			
			setContent(layout);
		} catch (Exception e) {
		}
	}

	private ExternalResource getNewFragmentResource(String newFragment) throws Exception {
		URL newUrl = getNewFragmentLocation(newFragment).toURL();
		return new ExternalResource(newUrl.toString());
	}

	private URI getNewFragmentLocation(String newFragment) throws Exception {
		URI location = getPage().getLocation();
		return new URI(location.getScheme(), location.getSchemeSpecificPart(), newFragment);
	}

	@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
	@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
	public static class MyUIServlet extends VaadinServlet {
	}
}
@vgoehrke vgoehrke changed the title Problem with Vaadin 8 and Navigation with IE11 Deep linking not working with Vaadin 8 and IE11 Jun 26, 2017
@vgoehrke
Copy link
Author

vgoehrke commented Jul 4, 2017

I've digged a little deeper, examining the vaadin framework source code, and found this commit: 62c44dd#diff-c9671120424bf25a674475b8cd3c3601. The changes in the UIConnector lead me to a known bug in the ie11 (see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3740423/ and https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3740423/), which will not be fixed by microsoft. In the commit, mentioned above, there seems to be a workaround using an ValueChangeHandler in the History class. I assume, this workaround is not working. Can anyone confirm this?

@vgoehrke
Copy link
Author

vgoehrke commented Jul 4, 2017

The workaround is definitely not working in my scenario. I added console log output in the popstate and the valuechangehandler (see commit: 62c44dd#diff-c9671120424bf25a674475b8cd3c3601 UIConnector.java init-Method). When browsing through an application, the popstate handler never gets called in ie11. The valuechangehandler is getting fired, if i enter an url or by clicking an anchor, only if the url differs from the last entered url. It doesn't matter what uri fragments are set respectively what states are pushed in between.

It seems, that ie11 does not recognize url changes by setting an uri fragment respectively pushing a state, even if the new url is displayed as the current url. Entering url a, then push state b, c, d, etc. and again entering url a, the valuechangehandler nor the popstatelistener is getting called.

@stale
Copy link

stale bot commented Mar 19, 2018

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

@stale stale bot added the Stale Stale bot label label Mar 19, 2018
@stale
Copy link

stale bot commented Sep 12, 2020

The issue was automatically closed due to inactivity. If you found some new details to it or started working on it, comment on the issue so that maintainers can re-open it.

@stale stale bot closed this as completed Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Stale bot label
Projects
None yet
Development

No branches or pull requests

1 participant