PDA

View Full Version : Loading the content pages of a site in an iframe without the disadvantages



molendijk
11-23-2012, 10:57 AM
Author: Arie Molendijk.

A script that loads the content pages of a site in an iframe. When the iframe is 'ready', the iframed page's URL is displayed in the main page. The address bar contains relevant info regarding the iframe's URL. The main page is static i.e. it doesn't change. It contains buttons for printing and bookmarking the iframed pages. Any iframed page that isn't accessed via the site's main page automatically puts itself on it (=on the main page), except when it belongs to a foreign domain.
The dynamic info in the main page regarding the iframed page's URL(s) is not lost when the visitor starts using the browser's history buttons.

Advantages:
No need to find a way to include the navigation menu (contained in the main page) on every page of the site, since the main page 'is always there'.
As the main page (containing the menu) never changes, there will be no flicker (white flash) on page transition.
Scripts running in the main page will not be stopped when the visitor goes from one page to another. So, for instance, a video started by a script in the main page will not be stopped on page transition.

DEMO here (http://www.mesdomaines.nu/eendracht/include_menu_web_templates9c). EDIT: updated 11-26-2012 --> 11-27-2012.

(I have submitted scripts like this one before, but this one essentially differs from the others in that the address bar and the iframe contain clearly visible info about the actual url of the pages).

Beverleyh
11-23-2012, 02:09 PM
That's looking realy smart Arie.

Thanks for sharing :)

molendijk
11-23-2012, 03:21 PM
My pleasure Beverleyh!

molendijk
11-26-2012, 09:20 PM
I changed the link to a newer version of the script.
The old script has certain issues related to the browser's history being unintentionally affected by the iframe-onloads.
Old (deprecated) version HERE (http://mesdomaines.nu/eendracht/include_menu_web_templates9).
New version HERE (http://mesdomaines.nu/eendracht/include_menu_web_templates9b).
Arie.

molendijk
11-27-2012, 08:17 PM
I made another improved version of the script. (Hope it's the last revision). Printing the pages has become a lot easier. The script knows now when to invoke the native browser's print function. So alerts with info on how to print are only produced now for foreign iframed pages.
I also inserted lines for detecting safari and distinguishing it from chrome, because chrome and safari behave differently regarding their instructions for printing and bookmarking pages.
First (deprecated) version HERE (http://mesdomaines.nu/eendracht/include_menu_web_templates9).
Second (deprecated) version HERE (http://mesdomaines.nu/eendracht/include_menu_web_templates9b).
Final version HERE (http://mesdomaines.nu/eendracht/include_menu_web_templates9c).