iframe

How to use iframe to (cross-domain) post request ?

血红的双手。 提交于 2019-12-21 05:11:11
问题 I want to do a post cross-domain request , I use a form which targeted a iframe to submit the request. var iframe = document.createElement("iframe"); var uniqueString = "CHANGE_THIS_TO_SOME_UNIQUE_STRING"; document.body.appendChild(iframe); iframe.style.display = "none"; iframe.contentWindow.name = uniqueString; var form = document.createElement("form"); form.target = uniqueString; form.action = myUrl; form.method = "POST"; // repeat for each parameter var input = document.createElement(

Modify iframe.src without entry to history object

故事扮演 提交于 2019-12-21 05:00:07
问题 I have an iframe in my web page. I modify the src property via javascript like so: document.getElementById('myiframe').src = 'http://vimeo.com/videoid1'; document.getElementById('myiframe').src = 'http://vimeo.com/videoid2'; document.getElementById('myiframe').src = 'http://vimeo.com/videoid3'; However, everytime I do this, it's logged into the browser's history. So everytime I press back in the browser window, the iframe content goes from videoid3 to videoid2 to videoid1. If I press back

jQuery Draggable Handler inside IFrame

纵然是瞬间 提交于 2019-12-21 04:52:34
问题 What a mouthful. Basically I have a parent <div> and inside that an <iframe> . I need an element inside the iframe to be the handle to drag the parent div. Is this even possible? I have tried: $(node).draggable("option","handle",$('iframe',node).contents().find('#handle')); $(node).draggable("option","handle",$('iframe',node).contents().find('#handle')[0]); It is targeting the right DOM element but it just won't drag. It might be possible to overlay a hidden div ontop of the iframe but I have

Understanding 3rd party iframes security?

左心房为你撑大大i 提交于 2019-12-21 04:49:12
问题 Facebook and others offer little iframe snipplets that I can put in my site. Example: <iframe src="http://www.facebook.com/widgets/like.php?href=http://example.com" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe> What I'd like to know is, if I put this code inside my side, could the code they load into my page access the DOM of my page? I see some security isssues if so. Likewise facebook allows me to put an iframe into their site, this is how facebook

Adding IFRAME to DOM by Javascript

核能气质少年 提交于 2019-12-21 04:31:09
问题 I want to add an iframe to the page. This iframe should refer to a URL. I added the below code to page HTML, but it doesn't work: document.createElement('<iframe src='http://example.com'></iframe>'); 回答1: Here you go: var iframe; iframe = document.createElement('iframe'); iframe.src = 'http://example.com/file.zip'; iframe.style.display = 'none'; document.body.appendChild(iframe); Live demo: http://jsfiddle.net/USSXF/2/ Your code doesn't work because you're passing an entire HTML string into

Setting iframe to take remaining space in page

主宰稳场 提交于 2019-12-21 04:26:21
问题 There are quite a lot of questions regarding iframe and it's height. Some are similar but not giving me the right answer. So let me explain my case: JSFiddle: http://jsfiddle.net/AmVhK/3/show/ Editor: http://jsfiddle.net/AmVhK/3/ There is a table with 2 rows. First one contains a div #toolbar with fixed height. Second row contains a div which holds an iframe. I need the iframe to take the available space below the toolbar div. Problem I am facing is in IE standards mode (supporting IE8+). Let

Why does jQuery remove body and head tags when populating an iframe with a style tag but not without?

一笑奈何 提交于 2019-12-21 04:25:21
问题 If I run the following code, the body and head tags are removed. <iframe src='blank.htm'> <html> <head> <style type="text/css"> </style> </head> <body> test </body> </html> </iframe> <script> $('iframe').load(function () { var contents = $('iframe').text(); $('iframe').contents().find('html').html(contents); }); </script> If I then remove the style tags, everything shows up correctly. Why is this and how can I get it to stop removing the head and body tags? I want the contents to be populated

Does window.addEventListener('message') overwrite other listeners? [duplicate]

大兔子大兔子 提交于 2019-12-21 04:01:21
问题 This question already has answers here : addEventListener overwrites other event actions? (2 answers) Closed 5 years ago . I've got some code that communicates with an iframe using .postMessage() , meaning it needs to add a listener on message to receive communication from the iframe. I'm using the usual code for that: window.addEventListener('message', processMessage, false); This code runs on a client's page that has a bunch of other stuff on it: Analytics, social buttons, etc. etc. I

How can I prevent an iframe from accessing parent frame?

我们两清 提交于 2019-12-21 03:55:26
问题 I've got a page with an iframe. The page and the source of the iframe are in different domains. Inside the iframe I'm using a rich text editor called CuteEditor (which has turned out to be not so cute). There are certain javascript functions in CuteEditor which try to access 'document' but the browser denies access since they're not in the same domain. Here's the exact error: Permission denied to access property 'document' http://dd.byu.edu/plugins/cuteeditor_files/Scripts/Dialog/DialogHead

Detect DOMContentLoaded in iframe

依然范特西╮ 提交于 2019-12-21 03:55:08
问题 I was surprised to find the following doesn't appear to work, insofar as the DOMContentLoaded event doesn't fire ( this.els is an object of elements). this.els.stage_ifr.prop('src', 'templates/'+ee.globals.creating+'/item'+this.id); this.els.stage_ifr[0].addEventListener('DOMContentLoaded', function() { alert('loaded!'); }, false); The page loads into the iframe fine, but no callback. The DOM level zero onload , however, works. this.els.stage_ifr[0].onload = function() { alert('loaded!'); };