HTML
  Home arrow HTML arrow Page 3 - Remote Scripting with iframes
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Remote Scripting with iframes
By: John Best
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-12-22

    Table of Contents:
  • Remote Scripting with iframes
  • Using iframes for Site Navigation
  • Passing Data from Parent Window to iframe using Query String
  • Other uses

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Remote Scripting with iframes - Passing Data from Parent Window to iframe using Query String


    (Page 3 of 4 )

    This time, the first thing that Joe did was change the extension of each of the pages of his site to .php so he could use them with a PHP include. Next, he added a query string to each of his links so that he could send data to the iframe utilizing the Get method. Since the Wizards' site had five pages, now the main page with menu and iframe looked something like this:

    <a href="menu.php?page=pageone.php" target="aname">page 1</a><br />

    <a href="menu.php?page=pagetwo.php" target="aname">page 2</a><br />

    <a href="menu.php?page=pagethree.php" target="aname">page 3</a><br />

    <a href="menu.php?page=pagefour.php" target="aname">page 4</a><br />

    <a href="menu.php?page=pagefive.php" target="aname">page 5</a>

    Then he wrote a simple PHP script called "menu.php" to switch the page content depending on which link was clicked, as follows:

    <?php

    $page = $_GET["page"];

    if ($page) {include ("$page");

    } else {

    include ("home.php");

    } ?>

    Finally, Joe created the iframe tag like this:

    <iframe src="menu.php" name="aname" width = 100% height = 530></iframe>


    Now the Wizards' site operated with no page reloads whatsoever! The main page remains loaded in the main window, and "menu.php" remains loaded in the iframe. As Joe clicked on the links of his menu, the page content changed, but the URL displayed in the browser address bar remained that of the main page. The Wizards fan club members were very impressed!

    Due to the inability of an iframe to resize itself to accommodate content of various sizes, this method is less than ideal for the purpose of content navigation, unless all of the pages of content are the same size. The example was chosen to illustrate both the advantages and a disadvantage of using iframes for remote scripting.

    Ajax request response methods can be used in a similar manner without a problem as far as varying content size, but they suffer from a drawback that the iframe navigation method we described does not. With the iframe method of navigation in the above example, the browser's "Back" button works as expected in most browsers. When the back button is clicked, the content in the iframe reverts to the previous content. The main page remains loaded. This is the behavior that the user probably expects, since it emulates how traditional navigation works.

    With request response methods, on the other hand, the back button will probably not work as expected in most browsers. In this case, when the back button is clicked, the main page reverts to the previous main page, which is not what the user would expect. There are workarounds for this problem, but they are ugly.

    More HTML Articles
    More By John Best


     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT