I’m currently facing a very weird problem with my Vaadin 7.1.5 app when used with the Internet Explorer (9&10).
I used a custom Fragment based Navigation system, similar to Navigator, so that i can use the Browser History to navigate through the “Pages”. That’s why when you open up a “Page”, which actually is a CustomComponent containing a Layout, i set the Fragment using for example this:
Page.getCurrent().setFragment("Home_"+Id);//Id increases per page
I also have set a Title in my UI.init method and i don’t use Page.setTitle anywhere else so that the title will stay the same.
Now my problem is that whenever you go to the Home Page (and only the Home Page) the last Fragment gets added to the Page title.
So for example if you have the Pages Home and Page1 if you go to Page1 the fragments gets set to #Page1_1 and if you then go back to home the title changes to: MyApp#Page1_1 while the url is …/MyApp#Home_2 . If you do the same thing again the title will say: MyApp#Page1_1#Page1_3
I looked through all the related code and even made a full search of “setTitle” over my entire Project using my Eclipse IDE but couldn’t find anything special.
Does anyone have even the slightest idea where this behavior could come from? Even if there is some other method i should look for which is able to change the title.
a quick googling suggests this might be a more widespread issue, see e.g.
this discussion . I haven’t seen (or noticed) this personally in Vaadin applications but I’d guess it’s the same issue. As a quick fix you could just reset the title whenever changing the fragment, but please also create a ticket - this could be fixed in the framework also.
Your suggestion would make sense but i find it weird that for me it only happens when i go to the Home-Tab/Component. When i change between the other menus it doesn’t change anything in the title. Only when i click on Home the last fragment gets added.
This is also what currently stops me from me from making a ticket as i have 5 processes doing the same thing but only one is causing the bug but it’s doing it consistent every time.
I may try to create a minimal test case and maybe just maybe i’ll be able to reproduce it.
Should i still create a ticket or should i wait and see if i can reproduce it?
The thing is that even when i comment out the line with setFragment in the Home-Component the title changes although i don’t do anything fragment or title related when detaching the other components or changing the menu tab (Using MenuBar).
well, by doing a few searches in Vaadin client-side code, the only thing that touches the page title is invoked by the explicit setTitle call from server side. And since you’ve confirmed that you are not calling it accidentally, I’d say it is some kind of IE issue.
IMO you can file the ticket, but then again a test case is always a plus for those. Especially if the issue does not manifest in the simplest possible case.
So i did some more testing and found out that the problem comes from my JavaScript Component which i added only to the Home-Page.
I’m currently digging through it’s library code (It’s a TagCloud) to see if something could cause this behavior or if it generally comes from using a Javascript Component.
Is document.title the only way of changing the title in Js because I found one place where the js object is trying to access it but commenting it out doesn’t change anything?
Could it maybe even be inside the Flash-Object (which is embedded using the Js-Object)?
When i find more details about the problem and can confirm that it is not actually coming from my own stupidity or from something that the Dev of the Js library added to the code i will file a ticket. Even if it comes from js code i might still file a ticket because it is shows inconsistent behavior between different browsers.
As far as I know, document.title is the only way to change the title from JS.
You might be onto something with the flash thing. I googled some more reports about the issue and it seems that in almost all of them Flash was part of the issue. In that case it might not be possible to fix this within Vaadin, and you’d just have to deal with it from your own code.
So it seems to actually be caused by the Flash object. The title is changed in the write method of the Js object which is embedding the Flash player in the div. I also tried removing every line which access document in that method but it didn’t change anything.
I also found another stackoverflow question where the hash was changed to the div surronding a Flash Object but only in IE. So there seem to be some problems with that combination.
My current workaround is to do this in the JavaScript connector:
var doctitle = document.title;
so.write("flashcontent"); //Changes Title
document.title = doctitle;
This seems to work for now and it isn’t even noticeable to the user.