admin管理员组

文章数量:1327982

I wish to maximize the iframe window so that it make a illusion that its a page not an iframe in Mozilla and IE both.

I have found an article on Stack Overflow: Maximize iFrame (so it appears to be the request page)

Applying this it solves the IE issue but not of Firefox.

I wish to maximize the iframe window so that it make a illusion that its a page not an iframe in Mozilla and IE both.

I have found an article on Stack Overflow: Maximize iFrame (so it appears to be the request page)

Applying this it solves the IE issue but not of Firefox.

Share Improve this question edited Mar 4, 2019 at 20:19 halfer 20.3k19 gold badges109 silver badges202 bronze badges asked Sep 30, 2009 at 14:21 AnkurAnkur 1614 silver badges15 bronze badges 7
  • 5 Apart from phishing, is there any valid use for such a trick? No offense, I'm just curious. – Thomas Commented Sep 30, 2009 at 14:22
  • I am just wondering why you need this. – Thomas Commented Sep 30, 2009 at 14:27
  • @Ankur to rephrase what Thomas said, Why do you need to do this? Using iframes in this way can be easily abused. – Samuel Commented Sep 30, 2009 at 14:28
  • Ok Thomas I want you to know where I want to use it basically I downt want to show the query string to the end user i use changing it to session is very length task so i simply add the pages on iframe thats all – Ankur Commented Sep 30, 2009 at 14:28
  • 1 Sounds to me like you're using the wrong strategy to solve your problem, since a user could just right-click on the page to view its URL and querystring. Additionally, your full URLs would show up in a google search if Googlebot indexed them. To make it plain and simple, security by obscurity = bad security. There are plenty of ways to share state between pages without passing it through the querystring, such as using the session or database. – Juliet Commented Sep 30, 2009 at 14:35
 |  Show 2 more ments

4 Answers 4

Reset to default 3

This works for me in FF 3.5

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3/1999/xhtml" xml:lang="en" lang="en"> 
 <head>
  <title>Test page!</title>
  <style type="text/css">
     html, body {
        overflow: hidden;
        margin: auto;
        height: 100%;
        width: 100%;
     }
  </style>
 </head>
 <body>
  <iframe src="page.htm" width="100%" height="100%" frameborder="0"></iframe>
 </body>
</html>

This sounds like a security exploitation. Do not actually attempt this. Even if your intent is not malicious anything that es through that iframe can carry potentially malicious code. The fastest growing vector of malicious code form JavaScript is through advertisements with crappy and easily promised code that loads through an iframe.

I urge you to reconsider your objectives and try something else. ANYTHING ELSE.

I have a site that uses an iframe. In Firefox I can just right-click the frame and say show this frame only and the URL shows in the address bar.

Do not count on this trick to hide the address of your content.

I've got a legitimate usage for this. I have a web application where I have to keep a track of a nominated client id for each window that might be created. I can't use cookies, because that only tracks on client, and I'm loathe to pass the client id through all my URLs, even the ones that don't need it.

So I'll be wrapping the main application view port with a iframe container that will use JS to set/get this client id in the parent/top container.

本文标签: javascriptHow to maximize iframe to cover entire page in Mozilla and IE bothStack Overflow