0

I built a singlepage website using a larger javascript framework, which is loaded during startup of the page. Now I try to span the page content over multiple tabs. For doing this, I open new tabs using subtab = window.open("","_blank") and fill the new windows dynamically with javascript subtab.document.body = .... Unfortunately I am not able to use the framework of the parent page. JQuery and the used KendoUI and Leaflet framework are not available within this childrens' contexts.

I know there are multiple possibilities to communicate between tabs:

  • Using the window.opener link to the parent page
  • Using cookies
  • Using localStorage

While the last two approaches are only interesting for sharing plain data, I played around with the first option. I tried to map interesting namespaces from the parent page to the subwindows global namespace XY = opener.XY. But it seems like it is not possible to solve the problem like this. (self = self.opener does not work either.) It's the same thing for css files.

So my question: Is there a possibility to reuse the whole window context of the opener within its child windows? Or does the cache work across multiple tabs and I can just include the whole framework again and again without causing a real reload?

Community
  • 1
  • 1
BaluJr.
  • 1,010
  • 2
  • 11
  • 25
  • Do your content pages render within a master template page (a.k.a. a shared header and/or footer)? If all your scripts load in the master page and all your content views are children of the master page, this is never a problem. All it takes is proper setup and route handling. – Brett Aug 17 '15 at 19:44
  • Yes they do somehow. There is a main template page for the first tab, which for example also owns a signalR connection to the server. Then I use a reduced template page for the additional tabs. (FYI: I am using ASP.MVC and have two different layout pages.) The question is, whether I have to include all of the scripts also in the reduced template page. To avoid misundersandings, with tabs I mean browser tabs, to allow the user to display the page over multiple screens. – BaluJr. Aug 17 '15 at 21:47

0 Answers0