Dav.id
Dav.id

Reputation: 2797

Alternatives to using an iFrame in order to keep the content modular? (this is an application rather than world facing app)

Long title but hopefully it explained most of what I need to say.

Basically I understand that iFrames in an SEO world are not necessarily good, and also about cross domain script attacks (will have to look up about them.. heard the phrase, don't know the details).

In my case I have a web application i.e. you need to login etc, and because I am trying to keep a few modules (pages/snippets) clean and separate (so they can be developed and tested independently), I figured iFrames are not that bad an option..

As I am heavily using jQuery, I have also used the .load() function for small sections, however I have always been unsure if this causes issues down the track because for the .load() function will load another html page complete with it's own headers/css/script includes etc..

Hence the idea for an iFrame..

So the question is really this; in the above example would anyone feel iFrames are not to be used? and if not, is the jQuery.load() option to pull in a full html page (albeit a smaller module page) the only other offer?

Thanks in advance for any insight into this.

David.

Upvotes: 0

Views: 457

Answers (1)

James Montagne
James Montagne

Reputation: 78650

If your only needs is to keep things separate, depending on which language you are using for your backend, there are generally options to include pages within other pages (for example, jsp has jsp:include). This will include the pages on the server-side. Assuming these pages are to be included every time, there's really no need to load it with and iframe or javascript.

If you do use the above method or jquery.load, you should strip the html, head, body etc. tags.

But, if iframes are already working for you, I don't see too strong of a reason to rewrite.

Upvotes: 1

Related Questions