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.

Filter by
Sorted by
Tagged with
1198 votes
28 answers

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?
user avatar
856 votes
15 answers

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: $(...
rz.'s user avatar
  • 19.9k
843 votes
26 answers

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

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 ...
mubashermubi's user avatar
  • 8,906
770 votes
18 answers

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 ...
akshat's user avatar
  • 15.5k
673 votes
17 answers

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....
Tamas Czinege's user avatar
641 votes
16 answers

Make iframe automatically adjust height according to the contents without using scrollbar? [duplicate]

For example: <iframe name="Stack" src="" width="740" frameborder="0" scrolling="no" id="iframe"> ... </iframe> I want it to be able to adjust its height ...
akashbc's user avatar
  • 6,425
520 votes
26 answers

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 ...
larssg's user avatar
  • 5,385
465 votes
8 answers

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 ...
Bungle's user avatar
  • 19.4k
453 votes
26 answers

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 ...
Garen Checkley's user avatar
438 votes
20 answers

Frame Buster Buster ... buster code needed

Let's say you don't want other sites to "frame" your site in an <iframe>: <iframe src=""></iframe> So you insert anti-framing, frame busting JavaScript into all ...
Jeff Atwood's user avatar
  • 63.4k
418 votes
35 answers

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 ...
StoneHeart's user avatar
  • 15.8k
413 votes
14 answers

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.
Haim Evgi's user avatar
  • 123k
384 votes
14 answers

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 ...
Ali's user avatar
  • 262k
368 votes
4 answers

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 ...
Bemmu's user avatar
  • 17.9k
339 votes
27 answers

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 ...
Darkthread's user avatar
  • 4,129
329 votes
11 answers

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=...
Arjun Singh's user avatar
  • 3,301
329 votes
14 answers

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?
user avatar
324 votes
20 answers

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" ""&...
copenndthagen's user avatar
311 votes
24 answers

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?
caffo's user avatar
  • 3,331
311 votes
14 answers

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-...
Misha Moroshko's user avatar
311 votes
5 answers

How do you post to an iframe?

How do you post data to an iframe?
Murtaza Mandvi's user avatar
311 votes
11 answers

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?
meleyal's user avatar
  • 32.3k
309 votes
7 answers

Get element from within an iFrame

How do you get a <div> from within an <iframe>?
joepour's user avatar
  • 6,851
282 votes
9 answers

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: ...
Amr Elgarhy's user avatar
  • 66.8k
274 votes
7 answers

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?
Danny Fox's user avatar
  • 38.8k
272 votes
4 answers

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 ...
cnst's user avatar
  • 26k
269 votes
24 answers

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 ...
karry's user avatar
  • 3,280
259 votes
16 answers

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 ...
472084's user avatar
  • 17.7k
253 votes
20 answers

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 ...
chronofwar's user avatar
  • 2,533
247 votes
12 answers

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.
stemlaur's user avatar
  • 2,471
242 votes
7 answers

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 ...
Matrym's user avatar
  • 16.7k
236 votes
15 answers

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="...
Darien Fawkes's user avatar
234 votes
10 answers

"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'...
Trufa's user avatar
  • 40k
224 votes
11 answers

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 ...
jd6699's user avatar
  • 2,277
219 votes
6 answers

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=""> <...
emersonthis's user avatar
  • 32.7k
207 votes
8 answers

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 ...
user3594437's user avatar
  • 2,103
202 votes
6 answers

Capture iframe load complete event

Is there a way to capture when the contents of an iframe have fully loaded from the parent page?
Jaime Garcia's user avatar
  • 6,784
195 votes
9 answers

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 ...
José Leal's user avatar
  • 8,009
191 votes
8 answers

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:...
Trevor Burnham's user avatar
191 votes
10 answers

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 ...
EtienneT's user avatar
  • 5,075
190 votes
18 answers

Remove scrollbar from iframe

Using this code <iframe frameborder="0" style="height: 185px; overflow:scroll; width: 100%" src="" marginheight="1" marginwidth="1" ...
Faith In Unseen Things's user avatar
187 votes
5 answers

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 ...
Max's user avatar
  • 4,152
187 votes
11 answers

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&...
omg's user avatar
  • 137k
181 votes
24 answers

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 ...
Brighton's user avatar
  • 2,083
176 votes
6 answers

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?
Daniel T.'s user avatar
  • 37.3k
176 votes
10 answers

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 {...
georgephillips's user avatar
165 votes
23 answers

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 ...
Russ Bradberry's user avatar
163 votes
18 answers

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="...
Matt Elhotiby's user avatar
156 votes
11 answers

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 ...
FlySwat's user avatar
  • 173k

2 3 4 5