iframe

How to use forceUpdate() correctly? [duplicate]

我们两清 提交于 2019-12-22 09:29:18
问题 This question already has answers here : What's the best way to periodically reload an iframe with React? (2 answers) Closed 6 months ago . I'm trying to periodically reload an iframe but i'm using React so i can't manipulate the DOM directly. It seems like my best option is to use forceUpdate() because the url isn't changing so i can't use a state change to update it (See previous post here What's the best way to periodically reload an iframe with React?). However when i try doing a

file:/// to http:// communication via IFrame

六眼飞鱼酱① 提交于 2019-12-22 08:57:54
问题 Maybe some of you could have ran into the same problem i did. Imagine you have a file on your machine: file:///c:\test.html And you have an IFrame inside of this file. You need to indicate whether the IFrame contents are loaded or no. Bacically, what we have here: 1. location, href, or any other property is inaccessible from file:/// to http:///, or backwards. 2. you can't fire event from the browser window in iframe, or in opposite direction, unfortunately. Does this problem have a solution?

Dynamically adjust an iframe's height

纵饮孤独 提交于 2019-12-22 08:54:51
问题 I have an iframe that contains some content from a site. I want the iframe to adjust to 100% of the src content's height. Bit of a noob at js - here's what I'm working with: <iframe id="frame" scrolling="no" frameborder="0" src="http://www.srcwebsite.org"></iframe> <script type="text/javascript"> function resizeIframe() { var height = document.documentElement.clientHeight; height -= document.getElementById('frame').offsetTop; height -= 20; /* whatever you set your body bottom margin/padding

Python selenium get inside a #document

百般思念 提交于 2019-12-22 08:35:15
问题 How can I keep looking for elements in a #document: <div> <iframe> #document <html> <body> <div> Element I want to find </div> </body> </html> </iframe> </div> 回答1: I think your problem is not with the a# document but with iframe . from selenium import webdriver driver = webdriver.Firefox() iframe = driver.find_elements_by_tag_name('iframe')[0] driver.switch_to_frame(iframe) driver.find_element_by_xpath("//div") 来源: https://stackoverflow.com/questions/38363643/python-selenium-get-inside-a

Inject Css into iframe from third party

折月煮酒 提交于 2019-12-22 08:23:20
问题 Can we inject bunch of CSS files into an iframe from a third party like OAS which is hosting ads? If it is possible an example will be greatly appreciated. 回答1: By using jQuery selectors, you should be able to do that. However there should not be any restriction on iframe contents (i.e it should be from same domain) For HTML update: $('iframe').contents().find("body") will get you body object $('iframe').contents().find("head") will get you header object. You can add style here Please refer

How to get iframe scroll position in IE using Java Script?

扶醉桌前 提交于 2019-12-22 08:04:13
问题 scrollPosition = window.frames[id].document.body.scrollTop; The above code doesn't work correctly. Please tell me how to correct it. 回答1: To get scrollTop in a crossbrowser way jQuery does this: function GetScrollTop() { var doc = document.documentElement var body = document.body; return ((doc && doc.scrollTop) || (body && body.scrollTop || 0)) - (doc.clientTop || 0); } I personally use simply this: return document.documentElement.scrollTop || document.body.scrollTop 回答2: If the frame's

IFrame content swapping bug?

我是研究僧i 提交于 2019-12-22 08:00:04
问题 I have a web page with a number of iframes, including 3rd party iframes like ad sense and various sharing buttons. In Firefox, I've noticed that occasionally the content of these iframes get swapped, such that you'll get an ad sense ad where another iframe is. It seems completely random where iframe content shows up. It seems it may have something to do with caching. Does anyone know what causes this, or any steps I can take to prevent this from happening? 回答1: In case anyone is looking I was

Recommended method to prevent any content inside iframe from setting cookies

筅森魡賤 提交于 2019-12-22 07:08:12
问题 I get the content to be put inside an iframe from a source I do not trust. For a particular need to be met, I want the content (which might include javascript) to be unable to set cookies at all. What is the recommended method to achieve that? Edit: I recognize this is similar to this question. I should have mentioned this earlier, but the iframe has a cross-origin source. I want to disable the content inside from setting cookies even on its own source. Does sandboxing achieve that? Thanks.

AJAX inside IFRAME not working against same server

天大地大妈咪最大 提交于 2019-12-22 06:59:52
问题 I'm using a website, abc.com , that is hosting an iframe of a page on 123.com . The page inside the iframe is doing an AJAX request to another page on 123.com , but we're seeing that the request is getting cancelled. Unless I'm wrong — and I haven't found any official information on the internet about this — the call should work fine as it is not a cross-domain request. Would the fact that the parent frame is on a different domain really hinder the iframe from doing AJAX requests to its own

youtube - cannot swipe past iframe in carousel / slider

末鹿安然 提交于 2019-12-22 06:57:13
问题 I have a responsive site with a carousel. The user can embed a youtube video as one of the slides. On desktop this works fine. On mobile however the iframe apparently eats all the swipe events and you cannot swipe past the video. We had to hack around this by substituting an image of the video and then using window.open() open a new window with the video. It sucks. Is there a good way to overcome this? 回答1: In short, I discovered I was doing it wrong. The slider script works very well on both