iframe

postMessage Source IFrame

烈酒焚心 提交于 2020-01-09 12:51:16
问题 I'm working on a website with cross-domain iframes that are resized to the correct height using postMessage. The only problem I'm having is identifying which iframe has which height. The way I've currently got it set up is that when one iframe sends its height to the parent, all the iframes' heights are changed. Parent: var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer = window[eventMethod]; var messageEvent = eventMethod == "attachEvent" ? "onmessage

Inserting the iframe into react component

本秂侑毒 提交于 2020-01-09 12:18:14
问题 I have a small problem. After requesting a data from a service I got an iframe code in response. <iframe src="https://www.example.com/show?data..." width="540" height="450"></iframe> I would like to pass this in as a props to my modal component and display it but when I simply {this.props.iframe} it in the render function it is obviously displaying it as a string. What is the base way to display it as html in react? 回答1: You can use property dangerouslySetInnerHTML, like this const Component

IFrame button click event

怎甘沉沦 提交于 2020-01-09 11:28:27
问题 I'm trying to attach an eventlistener to the "click" event of a button on a page in an IFrame. The page in the iframe belongs to the same domain as the parent window. window.frames["iframe_Id"].document.getElementById("button_id").addEventListener("click",functionToRun,false); The above sample is not working for me. It could just be a a syntax error in my actual code but I wanted to see if this is the general idea. Note: I found plenty of examples on adding the click event to the entire

javascript-How to detect scroll event in iframe?

天大地大妈咪最大 提交于 2020-01-09 11:20:12
问题 I have a problem when I try add event scroll with iframe tage. generally, I use scroll event with div tag It was working well. but when I add scroll event in iframe tag to detect user scroll pdf page, It was not working. why cannot I access html elements in iframe?, I have code inspect below: and I try to add javascript scroll event with iframe : HTML Code: <iframe id="myframe" src="doc.pdf"></iframe> JavaScript Code: document.getElementById('myframe').onscroll = function(){ alert('scrolling

Unloading/Removing content from an iFrame

假如想象 提交于 2020-01-09 08:56:08
问题 Is there anyway to unload a page that has been loaded inside an iframe? I do not want to change the iframe src to a blank page if possible. I am basically looking for something that will do something like this $('#frameID').attr("src",""); except that code does not seem to clear the previously loaded page. Is there a "unload" function that I can call which will reset the iframe so that it does not have any content loaded inside? 回答1: The other solutions use innerHTML , which won't always work

Is it possible to use iframes in IE without memory leaks?

。_饼干妹妹 提交于 2020-01-09 06:27:08
问题 All versions of IE (including 10) appear to hold on to a significant amount of memory allocated by iframes until window.top.unload occurs. This creates quite the challenge for long-lived pages that may create a number of iframes throughout their lifetime. A simplified example of the problem can be found here: http://pastebin.com/FmZ7iMHB That example uses a Wikipedia page for the iframe to magnify the problem, but even a simple page with a single image will leak. In a nutshell, after you

Is it possible to use iframes in IE without memory leaks?

社会主义新天地 提交于 2020-01-09 06:26:07
问题 All versions of IE (including 10) appear to hold on to a significant amount of memory allocated by iframes until window.top.unload occurs. This creates quite the challenge for long-lived pages that may create a number of iframes throughout their lifetime. A simplified example of the problem can be found here: http://pastebin.com/FmZ7iMHB That example uses a Wikipedia page for the iframe to magnify the problem, but even a simple page with a single image will leak. In a nutshell, after you

Get element value inside iframe which is nested inside Frame in javascript?

▼魔方 西西 提交于 2020-01-09 03:52:24
问题 I main php page in which there are 2 frames. Inside the second frame there is iframe. I want to access value of element on iframe document from the 1st frame. I tried like this: var frame1 = parent.frames[1]; var frame2 = frame1.document.getElementsByTagName('iframe')[0]; var eleValue =frame2.contentWindow.document.getElementById("MyElement").value; but I am not receiving any value though it is there. var frame1 = parent.frames[1]; alert(frame1.name); var frame2 = frame1.document

关于iframe标签的src属性

雨燕双飞 提交于 2020-01-09 00:49:08
iframe标签的src属性会发起一个get请求,这个不是检查在xhr里面看到的,直接看all,如果你看到xhr里面有post请求,并不是iframe的src能发送post请求,而是src请求回来的页面,里面有form表单等发起的post请求 来源: https://www.cnblogs.com/antyhouse/p/12169280.html

如何拿到iframe标签里面的src的内容,并且重新进行渲染

本小妞迷上赌 提交于 2020-01-09 00:48:31
<iframe width="100%" height="100%" seamless frameBorder="0" scrolling="no" :src='getSrc(item.frameLink)' > </iframe> 因为后台的直接返回的是iframe标签,不好去控制宽高 getSrc(item) { var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i; if (item.match(srcReg)) { var newText = item.match(srcReg)[1] } else { var newText = '' } return newText } 来源: https://www.cnblogs.com/antyhouse/p/12169293.html