SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Iframe inside php page going schizoid in Firefox!

    I have been working on templates that have polls and surveys as content. On my domain there is a folder called poll and contains the file index.php. This is the contents of index.php
    Code:
    <?php
    $debug = false ;
    //$debug = true ;
    
    if($debug)
    {
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    }
    ?>
    <?php 
    $GLOBALS['HTTP_SERVER_VARS']; //set global server variables
    extract($GLOBALS['HTTP_SERVER_VARS']); //extracts server variables
    
    include( $DOCUMENT_ROOT.'/inc/myfunctions.php');//includes custom functions
    ?>
    <?php get_poll(2,1); includes poll template and data set?>
    The function get_poll() is included by included myfunctions.php. This is the code for get_poll().
    Code:
    <?php
    function get_poll($poll_template, $poll_data)
    	{
    		global $dpath;//gets document root defined in myfunctions.php
    		
    		//sets witch poll template to use
    		$poll = $dpath. 'templates/poll/polltemplate'. $poll_template. '/poll.php';
    
    		//sets poll  data
    		$polldata = $dpath. 'templates/poll/polltemplate'. $poll_template. '/polldata/pd'. $poll_data. '.php';
    
    		include($polldata);//gets data to populate poll template
    		include($poll);//gets poll template
    
    	}
    ?>
    The two parameters $poll_template, $poll_data indicate are integers and indicate what template file to include and what poll data set to include respectively.

    In this case get_poll(2,1) would indicate include polltemplate2/poll.php into the /poll/index.php file. The polltemplate2/poll.php contains an- iframe.

    It is this iframe that is acting schizoid. For testing proposes, all other code sans the iframe has been removed form the page. Also the iframe was changed to include Google.com.

    Thus is the contents of templates/poll/polltemplate2/poll.php file:
    Code:
    <iframe src="http://google.com" name="ref" align="middle" frameborder="0" width="100%" height="100%" scrolling="no" marginwidth="0" marginheight="0"></iframe>
    When I visit "http://mydomain.com/poll" I expected to see google's home page inside a iframe. But instead my 404 error document activates then redirects to my domain's home page like the 404 error document is suppose to instead of showing google's home page.

    What is really odd is this only happens in Firefox 2.002and not IE 6.0. IE shows google's homepage in the iframe like it is supposed to do. Also, in Firefox if I directly view "http://mydomain.com/templates/poll/polltemplate2/poll.php" it behaves as expected and the iframe show google's home page.

    It seems that using php to include another php page the contains a iframe some how makes it impossible for the iframe to display the iframes content in Firefox.

    What mistake am I making with iframe?

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Don't have an answer to your question. But I am concerned about this line:
    Code:
    $GLOBALS['HTTP_SERVER_VARS']; //set global server variables
    extract($GLOBALS['HTTP_SERVER_VARS']); //extracts server variables
    I'm assuming you are using PHP 4.0.1 or some really old version...
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    Don't have an answer to your question. But I am concerned about this line:
    Code:
    $GLOBALS['HTTP_SERVER_VARS']; //set global server variables
    extract($GLOBALS['HTTP_SERVER_VARS']); //extracts server variables
    I'm assuming you are using PHP 4.0.1 or some really old version...


    What are your concerns?

    My old host disabled the use of $_SERVER variables. Therefore I started using $GLOBALS['HTTP_SERVER_VARS'] for my scripts.

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I might have figured it out. It looks like a caching problem with the iframe.

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by losirus View Post
    I think I might have figured it out. It looks like a caching problem with the iframe.
    I tried clearing the cache in firefox. But the problem still presists. It seems in some cases firefox ignores the iframes url. I don't know why?

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have discovered this is a bug in Firefox. The following link describes the same issue I am having:
    http://forums.mozillazine.org/viewto...07062#p2507062

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems this Firefox bug only affects the "src" attribute of the iframe tag and not the framset tag.

    Therefore, if you are in a situation where you are using iframe in Firefox and you need to change to "src" attribute dynamically; my workaround is:

    1. Create a target page that contains your iframe.
    2. Have the the above page "src" goto a framset page
    3. Code any dynamic changes to the "src" on the framset page


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •