www.webdeveloper.com
Results 1 to 7 of 7

Thread: Get url of a iFrame

  1. #1
    Join Date
    Oct 2012
    Posts
    4

    Get url of a iFrame

    Hi, i'm new on this forum.
    I need to get a url of an iframe from a form.
    A parent php page with an iframe, in the iframe the user can navigate and when the user has found his page click a button on the php parent page that send a variable to another php page with the frame url.
    It is possibile?

  2. #2
    Join Date
    Oct 2012
    Posts
    4
    The only thing i don't know how to do is to get the url of the frame. please help

  3. #3
    Join Date
    May 2003
    Posts
    599
    I think you want to use javascript to communicate across frames. even if you could use PHP, the user experience would not be that great... probably involve page refreshes.
    We do precision guesswork

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    If both the parent page and the iframe page are on the same domain, you can access functions in the parent from the iframe via JavaScript as:
    Code:
    window.parent.functionName()
    If they are on different domains, it's possible, but gets quite a bit more convoluted (and I'm not sure I could explain it correctly without doing a lot of research first).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Oct 2012
    Posts
    4
    i don't know javascript =(
    it's no possibile with php?

  6. #6
    Join Date
    Mar 2009
    Posts
    452
    post your code here, then we can help.

  7. #7
    Join Date
    Oct 2012
    Posts
    4
    PARENT PAGE:
    Code:
    [...]
    $url=www.google.it;
    echo ("<form method=GET action=geturl.php>
    	<p><iframe src=".$url.">
    	</iframe></p>
    	<p><input type=submit value=Invia></p>
    </form>");
    [...]
    THE FRAME IS A WEBSITE, BETHINK GOOGLE, the user can navigate on the frame and when has found the following webpage click on the submit and send the variable $url that will contain the url of the webpage to geturl.php.
    Last edited by marcolettieri; 10-11-2012 at 06:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles