Questions tagged [iframe]
An 'iframe' is an HTML element that creates an "inline frame" within a document, which allows displaying a separate document in the same page.
32,671
questions
1198
votes
28
answers
1.6m
views
How to apply CSS to iframe?
I have a simple page that has some iframe sections (to display RSS links). How can I apply the same CSS format from the main page to the page displayed in the iframe?
856
votes
15
answers
756k
views
How can I access the contents of an iframe with JavaScript/jQuery?
I would like to manipulate the HTML inside an iframe using jQuery.
I thought I'd be able to do this by setting the context of the jQuery function to be the document of the iframe, something like:
$(...
843
votes
26
answers
1.1m
views
Remove border from IFrame
How would I remove the border from an iframe embedded in my web app? An example of the iframe is:
<iframe src="myURL" width="300" height="300">Browser not compatible.</iframe>
I would ...
825
votes
9
answers
1.6m
views
SecurityError: Blocked a frame with origin from accessing a cross-origin frame
I am loading an <iframe> in my HTML page and trying to access the elements within it using JavaScript, but when I try to execute my code, I get the following error:
SecurityError: Blocked a ...
770
votes
18
answers
448k
views
How to identify if a webpage is being loaded inside an iframe or directly into the browser window?
I am writing an iframe based facebook app. Now I want to use the same html page to render the normal website as well as the canvas page within facebook. I want to know if I can determine whether the ...
673
votes
17
answers
588k
views
Invoking JavaScript code in an iframe from the parent page
Basically, I have an iframe embedded in a page and the iframe has some JavaScript routines I need to invoke from the parent page.
Now the opposite is quite simple as you only need to call parent....
641
votes
16
answers
1.5m
views
Make iframe automatically adjust height according to the contents without using scrollbar? [duplicate]
For example:
<iframe name="Stack" src="http://stackoverflow.com/" width="740"
frameborder="0" scrolling="no" id="iframe"> ...
</iframe>
I want it to be able to adjust its height ...
520
votes
26
answers
342k
views
Resizing an iframe based on content
I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes.
How do I resize the iframes to fit the height of the iframes' content?
I've ...
465
votes
8
answers
323k
views
Can I use multiple versions of jQuery on the same page?
A project I'm working on requires the use of jQuery on customers' Web pages. Customers will insert a chunk of code that we'll supply which includes a few <script> elements that build a widget in ...
453
votes
26
answers
787k
views
Overcoming "Display forbidden by X-Frame-Options"
I'm writing a tiny webpage whose purpose is to frame a few other pages, simply to consolidate them into a single browser window for ease of viewing. A few of the pages I'm trying to frame forbid ...
438
votes
20
answers
153k
views
Frame Buster Buster ... buster code needed
Let's say you don't want other sites to "frame" your site in an <iframe>:
<iframe src="http://example.org"></iframe>
So you insert anti-framing, frame busting JavaScript into all ...
418
votes
35
answers
904k
views
Adjust width and height of iframe to fit with content in it
I need a solution for auto-adjusting the width and height of an iframe to barely fit its content. The point is that the width and height can be changed after the iframe has been loaded. I guess I need ...
413
votes
14
answers
543k
views
How to force link from iframe to be opened in the parent window
I need to open the link in the same parent page, instead of open it in a new page.
note : The iframe and parent page are the same domain.
384
votes
14
answers
536k
views
Redirect parent window from an iframe action
What JavaScript do I need to use to redirect a parent window from an iframe?
I want them to click a hyperlink which, using JavaScript or any other method, would redirect the parent window to a new ...
368
votes
4
answers
188k
views
Debugging iframes with Chrome developer tools
I'd like to use the Chrome developer console to look at variables and DOM elements in my app, but the app exists inside an iframe (since it's an OpenSocial app).
So the situation is:
<containing ...
339
votes
27
answers
704k
views
Make Iframe to fit 100% of container's remaining height
I want to design a web page with a banner and an iframe. I hope the iframe can fill all the remaining page height and be resized automatically as the browser is resizing. Is it possible to get it done ...
329
votes
11
answers
506k
views
Calling a parent window function from an iframe
I want to call a parent window JavaScript function from an iframe.
<script>
function abc()
{
alert("sss");
}
</script>
<iframe id="myFrame">
<a onclick=...
329
votes
14
answers
592k
views
Using CSS to affect div style inside iframe
Is it possible to change styles of a div that resides inside an iframe on the page using CSS only?
324
votes
20
answers
1.1m
views
Full-screen iframe with a height of 100%
Is iframe height=100% supported in all browsers?
I am using doctype as:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&...
311
votes
24
answers
592k
views
What’s the best way to reload / refresh an iframe?
I would like to reload an <iframe> using JavaScript. The best way I found until now was set the iframe’s src attribute to itself, but this isn’t very clean. Any ideas?
311
votes
14
answers
676k
views
How to center an iframe horizontally?
Consider the following example: (live demo)
HTML:
<div>div</div>
<iframe></iframe>
CSS:
div, iframe {
width: 100px;
height: 50px;
margin: 0 auto;
background-...
311
votes
5
answers
461k
views
How do you post to an iframe?
How do you post data to an iframe?
311
votes
11
answers
204k
views
Are iframes considered 'bad practice'? [closed]
Somewhere along the line I picked up the notion that using iframes is 'bad practice'.
Is this true? What are the pros/cons of using them?
309
votes
7
answers
469k
views
Get element from within an iFrame
How do you get a <div> from within an <iframe>?
282
votes
9
answers
366k
views
how to access iFrame parent page using jquery?
I have an iframe and in order to access parent element I implemented following code:
window.parent.document.getElementById('parentPrice').innerHTML
How to get the same result using jquery?
UPDATE: ...
274
votes
7
answers
256k
views
How to communicate between iframe and the parent site?
The website in the iframe isn't located in the same domain, but both are mine, and I would like to communicate between the iframe and the parent site. Is it possible?
272
votes
4
answers
223k
views
Difference between iframe, embed and object elements
HTML5 defines several embedded content elements, which, from a bird's-eye view, seem to be very similar to the point of being largely identical.
What is the actual difference between iframe, embed ...
269
votes
24
answers
567k
views
make iframe height dynamic based on content inside- JQUERY/Javascript
I am loading an aspx web page in an iframe. The content in the Iframe can be of more height than the iframe's height. The iframe should not have scroll bars.
I have a wrapper div tag inside the ...
259
votes
16
answers
982k
views
How to embed an autoplaying YouTube video in an iframe?
I am trying to embed the new iframe version of a YouTube video and get it to auto play.
As far as I can tell, there is no way of doing this by amending flags to the URL. Is there a way to do it by ...
253
votes
20
answers
383k
views
Access parent URL from iframe
Okay, I have a page on and on this page I have an iframe. What I need to do is on the iframe page, find out what the URL of the main page is.
I have searched around and I know that this is not ...
247
votes
12
answers
725k
views
Alternative to iFrames with HTML5
I would like to know if there is an alternative to iFrames with HTML5.
I mean by that, be able to inject cross-domains HTML inside of a webpage without using an iFrame.
242
votes
7
answers
337k
views
iFrame src change event detection?
Assuming I have no control over the content in the iframe, is there any way that I can detect a src change in it via the parent page? Some sort of onload maybe?
My last resort is to do a 1 second ...
236
votes
15
answers
1.1m
views
How can I set 'X-Frame-Options' on an iframe?
If I create an iframe like this:
var dialog = $('<div id="' + dialogId + '" align="center"><iframe id="' + frameId + '" src="' + url + '" width="...
234
votes
10
answers
641k
views
"Full screen" <iframe>
When I use the following code to create an iframe:
<iframe src="mypage.html" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>
The iframe doesn'...
224
votes
11
answers
675k
views
Override body style for content in an iframe
How can I control the background image and colour of a body element within an iframe? Note, the embedded body element has a class, and the iframe is of a page that is part of my site.
The reason I ...
219
votes
6
answers
266k
views
How to set an iframe src attribute from a variable in AngularJS
I'm trying to set the src attribute of an iframe from a variable and I can't get it to work...
The markup:
<div class="col-xs-12" ng-controller="AppCtrl">
<ul class="">
<...
207
votes
8
answers
345k
views
Failed to load resource: net::ERR_INSECURE_RESPONSE
IS there a way to trick the server so I don't get this error:
Content was blocked because it was not signed by a valid security certificate.
I'm pulling an iframe of an html website into another ...
202
votes
6
answers
402k
views
Capture iframe load complete event
Is there a way to capture when the contents of an iframe have fully loaded from the parent page?
195
votes
9
answers
479k
views
How to access parent Iframe from JavaScript
Well, I have an IFrame, which calls a same domain page.
My problem is that I want to access some information from this parent Iframe from this called page (from JavaScript). How can I access this ...
191
votes
8
answers
308k
views
Creating an iframe with given HTML dynamically
I'm trying to create an iframe from JavaScript and fill it with arbitrary HTML, like so:
var html = '<body>Foo</body>';
var iframe = document.createElement('iframe');
iframe.src = 'data:...
191
votes
10
answers
359k
views
jQuery .ready in a dynamically inserted iframe
We are using jQuery thickbox to dynamically display an iframe when someone clicks on a picture. In this iframe, we are using galleria a javascript library to display multiple pictures.
The problem ...
190
votes
18
answers
701k
views
Remove scrollbar from iframe
Using this code
<iframe frameborder="0" style="height: 185px; overflow:scroll; width: 100%" src="http://www.cbox.ws/box/?boxid=439&boxtag=7868&sec=main" marginheight="1" marginwidth="1" ...
187
votes
5
answers
241k
views
Html code as IFRAME source rather than a URL
This standard code for an IFRAME, is there a way to replace the src URL with Just html code? so my problem is simple, I have a page it loads an HTML body from MYSQL I want to present that code in a ...
187
votes
11
answers
575k
views
How to get the body's content of an iframe in Javascript?
<iframe id="id_description_iframe" class="rte-zone" height="200" frameborder="0" title="description">
<html>
<head></head>
<body class="frameBody">
test&...
181
votes
24
answers
537k
views
Making an iframe responsive
I was reading Can You Make an iFrame Responsive?, and one of the comments/answers led me to this JSFiddle.
But when I tried to implement the HTML and CSS to fit my needs, I didn't have the same ...
176
votes
6
answers
170k
views
Why are iframes considered dangerous and a security risk?
Why are iframes considered dangerous and a security risk? Can someone describe an example of a case where it can be used maliciously?
176
votes
10
answers
486k
views
How to allow http content within an iframe on a https site
I load some HTML into an iframe but when a file referenced is using http, not https, I get the following error:
[blocked] The page at {current_pagename} ran insecure content from {...
165
votes
23
answers
252k
views
Detect Click into Iframe using JavaScript
I understand that it is not possible to tell what the user is doing inside an iframe if it is cross domain. What I would like to do is track if the user clicked at all in the iframe. I imagine a ...
163
votes
18
answers
357k
views
Reload an iframe with jQuery
I have two iframes on a page and one makes changes to the other but the other iframe doesn't show the change until I refresh. Is there an easy way to refresh this iframe with jQuery?
<div class="...
156
votes
11
answers
283k
views
Javascript callback when IFRAME is finished loading?
I need to execute a callback when an IFRAME has finished loading. I have no control over the content in the IFRAME, so I can't fire the callback from there.
This IFRAME is programmaticly created, and ...