Architecture – Pros and Cons of odd iframe ‘architecture’

angularjsArchitectureseparation-of-concerns

I'm in the process of experimenting with ways of breaking up a large (and growing project). Currently, we're working with a big Angular application with what will soon be a large number of components.

One idea I'd like to try is breaking each component into a completely separate website/project, as a collection of plugins to the main website. Essentially, instead of pulling in an ng-view, I'd just be sticking an iframe in and displaying the content in there.

There are a few cons that I've noted myself already:

  1. iframes can be horrible

  2. deployment is more complicated

  3. communicating between the plugins is less straightforward

I'm hoping that some of the pros might turn out to be:

  1. don't have to redeploy solution to add new components to site

  2. teams working on products can do so however they like. They can use any technology and approach, and aren't limited to Angular

Does anyone have any experience with this sort of approach? Any pros and cons to add to this approach? It's divided opinion at work a little so would be nice to have more input from the Internet.

Best Answer

The biggest downside of iframes is that an extra http request to the server is sent each time an iframe or multiple iframes are loaded inside a page. Also javscript and other resources are harder to share with the parent page if that's necessary.

Why not use server sided includes for different components or ajax requests for the included components or content?

Just converted a website away from iframes to ajax requests and the load on the server is so much less.

Related Topic