Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:16:30+00:00 2026-06-18T05:16:30+00:00

I have an iframe on a webpage, and from the iframe i want to

  • 0

I have an iframe on a webpage, and from the iframe i want to get the url of the parent window. Yes, i have been searching the web, but i keep getting solutions with JavaScript.

So do your guys know any solutions that only uses PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:16:31+00:00Added an answer on June 18, 2026 at 5:16 am

    A server-side script has no way of knowing anything about the client-side without the client side explicitly sending data, e.g. using AJAX.

    If you have control over the iframe itself, you could always pass variables along in the query string and access them using $_GET:

    HTML

    <iframe src="http://example.com/file.php?variable=value"></iframe>
    

    PHP

    <?php
    
        echo $_GET['variable'] // Outputs 'value'
    
    ?>
    

    UPDATE (this might actually be possible)

    There might be a way using $_SERVER['HTTP_REFERER']. An HTML file containing an iframe sends some headers as it requests the file, and one of them appears to be the HTTP_REFERER. I tested this locally and it seems to work.

    The only downside is you have no idea of knowing whether the referrer is an iframe or not. Again, if you have control over the iframe, you could pass a variable along using the method above saying it’s an iframe, and use the method below to get the URL dynamically.

    Example, let’s say this file’s URL is http://example.com/:

    <iframe src="http://example.com/file.php"></iframe>
    

    The PHP file, we’ll call it file.php:

    <?php
        echo $_SERVER['HTTP_REFERER']; // Should output http://example.com.
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this iFrame in my parent window... <iFrame src=http://theirdomain.com id=Post_iFrame></iFrame> Then I have
In my web page I have an iframe that displays another page. I want
I have a webpage i download and put into an iframe, to get the
I have a web page surrounding an iframe from another website. I need to
I have a drupal website. I want to generate an Iframe with content from
I have a webpage where I have an Iframe. When someone clicks something in
I have an iframe embedded on my webpage and I'd like to edit certain
I have an iframe where the web page inside of the iframe runs a
I have an iframe in the same domain as the web page. I have
I have a web page into a html iframe, the web page has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.