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 6618471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:50:17+00:00 2026-05-25T20:50:17+00:00

I have an IFrame inside my 1st page that loads another page which I

  • 0

I have an IFrame inside my 1st page that loads another page which I don’t want it to be accessed directly. So I thought maybe I can be sure that the 2nd page is loaded inside 1st one if I check the top.location in 2nd page and do as normal if it’s equal 1st page URL or remember user as hacker if it’s not.

Here is the code:

1st Page:

<html>
<head>
<title>1st Page</title>
</head>

<iframe src="2nd Page" name="frame1" height="80%" width="100%"></iframe>

</html>

2nd Page:

<script type="text/javascript">
    if(top.location == "1st Page URL") {
        // It's OK, Access is not direct
    } else {
        // It's not a normal access
    }
</script>  

It seems that this code will work fine, but I’m not sure if it’s foolproof or not. Maybe top.location could be spoofed (like $_SERVER['HTTP_REFERER']) or it’s totally unreliable somehow. I need to be sure about that.

  • 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-05-25T20:50:18+00:00Added an answer on May 25, 2026 at 8:50 pm

    Well, you can use JSPs. Have your second page, the one that should never be accessed directy placed in the WEB-INF folder of your project, and then have the main page do a jsp:forward towards that resource. This way the 2nd page can never be accessed directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iFrame, content of which is inside another iFrame. I want to
I have an iframe that loads a page inside it.. when a link is
i have iframe inside a page, and this iframe contain a submit button which
I have an iframe (iframe.php) inside my main page (index.php). I want to echo
I have an iframe on my page, and inside that iframe I execute code:
I have a iframe-1 and it contains another iframe-1-1 . [1] Inside iframe-1-1 which
I have a page in html (parent page) that have inside an iframe. When
I have an iframe tab which holds php page with various links inside (like
I have a page being loaded in an <iframe> . Inside the <iframe> ,
I have a script that dynamically loads iframes inside a webpage. You can see

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.