Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 427350

Summary: [BrowserHistory] not working in IE11 since RAP 2.2 (with IFrames)
Product: [RT] RAP Reporter: Flavio Donze <flavio.donze>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: 2.2   
Target Milestone: 2.3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Modified mail demo application
none
target definition RAP 2.1 none

Description Flavio Donze CLA 2014-02-04 05:24:48 EST
Created attachment 239603 [details]
Modified mail demo application

We have a RAP application where we use the browser history to store IDs and navigate back and forward between them. 
Since RAP 2.2 this is not working anymore on IE 11, still works on Firefox 26 and Chrome 32.

I narrowed it down to the IFrame we are using in the editor, which contains a Browser widget.

To isolate the problem I modified the mail demo (see attachment), the three relevant parts are:

ApplicationWorkbenchWindowAdvisor.java
public void postWindowCreate() {
	BrowserNavigation navigation = RWT.getClient().getService(BrowserNavigation.class);
	navigation.addBrowserNavigationListener(new BrowserNavigationListener() {
		@Override
		public void navigated(BrowserNavigationEvent event) {
			System.out.println("navigated state=" + event.getState());
		}
	});
}


NavigationView.java
BrowserNavigation navigation = RWT.getClient().getService(BrowserNavigation.class);
System.out.println("pushState(" + name + ", " + name + ")");
navigation.pushState(name, name);

BrowserEditor.java
//					browser.setText("<html><body>NO IFRAME</body></html>");
browser.setText("<html><body><iframe id=\"testframe\" frameborder=\"0\" /></body></html>");


In the tree selecting "Inbox", "Drafts" and "Sent", then hitting twice on "backward" from the browser, this is the output I get when using the IFrame in BrowserEditor:
pushState(Inbox, Inbox)
pushState(Drafts, Drafts)
pushState(Sent, Sent)
navigated state=
... here the browser left the RAP application.

If I do not use the IFrame I get the this output:
pushState(Inbox, Inbox)
pushState(Drafts, Drafts)
pushState(Sent, Sent)
navigated state=Drafts
navigated state=Inbox

So somehow IFrames mess up the history since RAP 2.2. I compared the sources with 2.1 and hoped only a few lines have changed, but 
it looks like the whole BrowserNavigation has been refactored.
Comment 1 Ivan Furnadjiev CLA 2014-02-04 11:30:55 EST
Does it work with RAP 2.1? This is very old and known issue that the Browser widget interferes with BrowserNavigation. See bug 296382.
Comment 2 Flavio Donze CLA 2014-02-05 04:25:31 EST
Created attachment 239651 [details]
target definition RAP 2.1

Yes it worked with 2.1, just tested it again. This is the output I get:

pushState(Inbox, Inbox)
pushState(Drafts, Drafts)
pushState(Sent, Sent)
navigated state=Drafts
navigated state=Inbox
navigated state=

As it should be.

I attached the target definition for 2.1.
Comment 3 Ivan Furnadjiev CLA 2014-02-07 03:10:15 EST
In RAP 2.1 IE11 was not identified correctly (see bug 421529) and probably IE run in quirks mode. This could be the reason, why it's working in 2.1, but not in 2.2. Nevertheless, as I stated in comment#1, it's a known issue that Browser widget (iframe) interferes with BrowserNavigation as native browser history tracks iframe url changes as well. This is a browser dependent behavior.
Comment 4 Ivan Furnadjiev CLA 2014-02-07 03:11:07 EST
BTW... did you try with IE9/IE10 and RAP 2.1?
Comment 5 Flavio Donze CLA 2014-02-07 08:31:20 EST
Just tested with IE10 and IE9 using RAP 2.1 and the history works fine.

Could it be the new implementation BrowserNavigationImpl? In 2.1 it implemented PhaseListener and UISessionListener, in 2.2 it doesn't?
Comment 6 Ivan Furnadjiev CLA 2014-02-07 09:24:45 EST
(In reply to comment #5)
> Just tested with IE10 and IE9 using RAP 2.1 and the history works fine.
> 
> Could it be the new implementation BrowserNavigationImpl? In 2.1 it implemented
> PhaseListener and UISessionListener, in 2.2 it doesn't?
No... As I stated in comment#3 this behavior is cased by setting the default rendering mode for IE11 (bug 421529). 
If you revert the change in rwt-index.html from:
<meta http-equiv="X-UA-Compatible" content="IE=5,9,10,11;" >
to:
<meta http-equiv="X-UA-Compatible" content="IE=5,9,10;" >
new states are added to browser history again, but IE11 is running in IE10 mode.
Comment 7 Flavio Donze CLA 2014-02-07 10:00:01 EST
Just to verify I changed the line to
<meta http-equiv="X-UA-Compatible" content="IE=5,9,10;" >
and now it works.

I'll just use this "hack".
Comment 8 Flavio Donze CLA 2014-07-08 14:07:32 EDT
This seems to be fixed in RAP 2.3. 
Issue can be closed, thanks a lot for fixing!
Comment 9 Ivan Furnadjiev CLA 2014-07-08 16:55:15 EDT
(In reply to Flavio Donze from comment #8)
> This seems to be fixed in RAP 2.3. 
> Issue can be closed, thanks a lot for fixing!

I don't remember any fix related to this issue, but I'll close it as fixed. Please reopen if the issue persists.