There are basically 3 client side ways of including external content into a page: we can load separate html files IN a visible iframe ('standard iframe include'), VIA a hidden iframe ('hidden iframe include') or VIA Ajax ('Ajax include'). Each way has its specific advantages and limitations.

External content that is fetched via the hidden iframe technique or Ajax will not behave as expected if it contains run time javascript. At least, the javascript will not run by itself, because both the hidden iframe and Ajax simply dump text to the main page, without preservation of code. There's no general way to 'correct' this. Workarounds will depend on the specific code contained in the external file(s). They need to be custom tailored based on the scripts in question.

Including external content in a standard (visible) iframe doesn't have this drawback, since iframes are independent windows. But precisely because of that, it's often hard to incorporate them as seamless parts of a page. For instance, they will have their own scroll bars as soon as their contents don't fit their size. As for including a modern (html) navigation menu, it seems difficult to use a standard iframe because the space reserved for the subitems of menus must not be limited to a portion only of the screen, which is the size of the iframe.

It seems that none of the three techniques for including external content is superior to the other two ones in all respects. Yet, people tend to prefer Ajax to both types of iframe includes. Why? It would take too long to answer this question here, and to discuss the matter in more detail. So I made a site for the purpose of doing just that: discuss the pros and cons of several types of includes. Go for further reading to

Arie Molendijk.