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.

iframe
Filter by
Sorted by
Tagged with
1210 votes
28 answers
1.7m 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?
user avatar
857 votes
15 answers
765k 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: $(...
rz.'s user avatar
  • 20k
852 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 ...
840 votes
9 answers
1.7m 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 ...
mubashermubi's user avatar
  • 9,066
786 votes
18 answers
466k 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 ...
akshat's user avatar
  • 15.7k
677 votes
17 answers
600k 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....
Tamas Czinege's user avatar
654 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 ...
akashbc's user avatar
  • 6,555
521 votes
26 answers
344k 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 ...
larssg's user avatar
  • 5,395
465 votes
8 answers
326k 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 ...
Bungle's user avatar
  • 19.6k
454 votes
26 answers
796k 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 ...
Garen Checkley's user avatar
438 votes
20 answers
156k 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 ...
Jeff Atwood's user avatar
  • 63.7k
424 votes
34 answers
934k 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 ...
StoneHeart's user avatar
  • 16.2k
416 votes
14 answers
551k 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.
Haim Evgi's user avatar
  • 124k
390 votes
14 answers
548k 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 ...
Ali's user avatar
  • 265k
372 votes
4 answers
197k 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 ...
Bemmu's user avatar
  • 18k
348 votes
28 answers
726k 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 ...
Darkthread's user avatar
  • 4,219
336 votes
14 answers
614k 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?
user avatar
334 votes
11 answers
515k 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=...
Arjun Singh's user avatar
  • 3,351
329 votes
20 answers
1.2m 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"&...
copenndthagen's user avatar
318 votes
24 answers
614k 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?
caffo's user avatar
  • 3,401
316 votes
7 answers
484k views

Get element from within an iFrame

How do you get a <div> from within an <iframe>?
joepour's user avatar
  • 6,971
315 votes
14 answers
704k 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-...
Misha Moroshko's user avatar
315 votes
11 answers
208k 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?
meleyal's user avatar
  • 32.8k
313 votes
5 answers
469k views

How do you post to an iframe?

How do you post data to an iframe?
Murtaza Mandvi's user avatar
283 votes
9 answers
368k 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: ...
Amr Elgarhy's user avatar
  • 67.8k
281 votes
5 answers
236k 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 ...
cnst's user avatar
  • 26.5k
279 votes
7 answers
271k 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?
Danny Fox's user avatar
  • 39.7k
271 votes
24 answers
587k 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 ...
karry's user avatar
  • 3,300
264 votes
16 answers
1.0m 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 ...
472084's user avatar
  • 17.8k
258 votes
20 answers
401k 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 ...
chronofwar's user avatar
  • 2,583
250 votes
12 answers
748k 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.
stemlaur's user avatar
  • 2,501
243 votes
7 answers
348k 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 ...
Matrym's user avatar
  • 16.9k
242 votes
10 answers
665k 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'...
Trufa's user avatar
  • 40.5k
241 votes
16 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="...
Darien Fawkes's user avatar
232 votes
12 answers
700k 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 ...
jd6699's user avatar
  • 2,357
219 votes
6 answers
267k 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=""> <...
emersonthis's user avatar
210 votes
6 answers
422k 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?
Jaime Garcia's user avatar
  • 6,978
207 votes
8 answers
346k 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 ...
user3594437's user avatar
  • 2,103
198 votes
18 answers
732k 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" ...
Faith In Unseen Things's user avatar
196 votes
8 answers
318k 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:...
Trevor Burnham's user avatar
195 votes
9 answers
487k 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 ...
José Leal's user avatar
  • 8,059
191 votes
5 answers
255k 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 ...
Max's user avatar
  • 4,262
191 votes
10 answers
360k 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 ...
EtienneT's user avatar
  • 5,227
190 votes
13 answers
593k 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&...
omg's user avatar
  • 138k
184 votes
24 answers
548k 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 ...
Brighton's user avatar
  • 2,113
179 votes
6 answers
179k 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?
Daniel T.'s user avatar
  • 37.7k
176 votes
10 answers
498k 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 {...
georgephillips's user avatar
167 votes
23 answers
258k 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 ...
Russ Bradberry's user avatar
163 votes
18 answers
360k 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="...
Matt Elhotiby's user avatar
159 votes
11 answers
285k 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 ...
FlySwat's user avatar
  • 174k

1
2 3 4 5
656