Search code examples
backbone.jsrequest

Tunneling one page apps (e.g. Backbone)


I would like to know if it is possible to nest/tunnel javascript rendered sites.

What I mean concrete:

I got a site bugs.example.org which serves a bug tracker application built on Backbone Routers, Views and Models.

over bugs.example.org/#/mybugs we can list all our bugs.

Now I have for example a second project worksuite.example.org. This project serves roadmaps, presentations, etc. unfortunately this worksuite app doesn't serve an independent bug tracker. Instead it has a joint venture with bugs.example.org. Now worksuite.example.org want to include/nest the bugtracker views in its own application.

This could look like: worksuite client calls worksuite.example.org/#/bugs now the worksuite app calls a GET to bugs.example.org/#/mybugs and does a $el.html(requestedContent). Does this work?

Another application which could work similar, which I know is the google captcha service which you nest with some js

Is there a keyword for such behavior?


Solution

  • Depending on how well the backbone app is architected, you can have worksuite.example.org just pull all of bugs.example.org's JS files, but use its own base html/css:

    <!-- on bugs.example.org -->
    <script src="mybackbonestuff.js"></script>
    <link href="mycss.css"></link>
    
    <!-- on worksuite.example.org -->
    <script src="http://bugs.example.org/mybackbonestuff.js"></script>
    <link href="worksuite.css"></link>