iframe

Retrieving HTTP status code from loaded iframe with Javascript

依然范特西╮ 提交于 2019-12-27 23:36:37
问题 I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the server. For example, if the server returns 404, the data from the iframe will be copied as normal and treated as a regular response. I've tried poking around in the iframe objects looking for some sort of status_code

Comet 和 WebSocket

…衆ロ難τιáo~ 提交于 2019-12-27 20:25:58
众所周知,HTTP 协议,是无状态的,所以不能保持持续的链接。数据交换是通过客户端提交一个 Request 到服务器端,然后服务器端返回一个 Response 到客户端来实现的。 轮询(polling) 一般情况下,通过浏览器访问一个网页,需要浏览器发送一个 HTTP Request,服务器接收到浏览器的请求,返回相应的消息。在一些数据更新比较频繁的应用里,页面的数据要想得到最新的结果需要重新刷新页面,但这样会产生大量的冗余数据在服务器和客户端传输。 可以看到,不论是javascript定时轮询,还是采用html的 http-equiv="refresh" 定时刷新页面,只要采用polling的方式,效率都是十分低下的,一方面,服务器端不是总有数据更新,所以每次问询不一定都有更新,效率低下;另一方面,当发起请求的客户端数量增加,服务器端的接受的请求数量会大量上升,无形中就增加了服务器的压力。 Comet Comet是一种用于web的技术,能使服务器能实时地将更新的信息传送到客户端,而无须客户端发出请求,目前有两种实现方式,长轮询和iframe流。 Comet这个单词,很多地方都会说到,它是“彗星”的意思,顾名思义,彗星有个长长的尾巴,以此来说明客户端发起的请求是长连接的。即用户发起请求后就挂起,等待服务器返回数据,在此期间不会断开连接。流方式和长轮询方式的区别就是:对于流方式

Is there a way to uniquely identify an iframe that the content script runs in for my Chrome extension?

人走茶凉 提交于 2019-12-27 17:59:26
问题 In my Chrome extension I am injecting the content script into all IFRAMEs inside a page. Here's a part of the manifest.json file: "content_scripts": [ { "run_at": "document_end", "all_frames" : true, "match_about_blank": true, "matches": ["http://*/*", "https://*/*"], "js": ["content.js"] } ], So a single web page having multiple IFRAMEs will end up running that many copies of my injected content.js . The logic inside content.js collects data from each IFRAME it's injected into, or from the

Detect mousemove when over an iframe?

删除回忆录丶 提交于 2019-12-27 17:37:11
问题 I have an iframe that takes up the entire window (100% wide, 100% high), and I need the main window to be able to detect when the mouse has been moved. Already tried an onMouseMove attribute on the iframe and it obviously didn't work. Also tried wrapping the iframe in a div like so: <div onmousemove="alert('justfortesting');"><iframe src="foo.bar"></iframe></div> .. and it didn't work. Any suggestions? 回答1: If your target isn't Opera 9 or lower and IE 9 or lower you can use css attribute

Nested iframes, AKA Iframe Inception

左心房为你撑大大i 提交于 2019-12-27 17:29:19
问题 Using jQuery I am trying to access div id="element". <body> <iframe id="uploads"> <iframe> <div id="element">...</div> </iframe> </iframe> </body> All iframes are on the same domain with no www / non-www issues. I have successfully selected elements within the first iframe but not the second nested iframe. I have tried a few things, this is the most recent (and a pretty desperate attempt). var iframe = jQuery('#upload').contents(); var iframeInner = jQuery(iframe).find('iframe').contents();

Safari/Chrome (Webkit) - Cannot hide iframe vertical scrollbar

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-27 17:04:57
问题 I have an iframe on www.example.com that points to support.example.com (which is a CNAME to a foreign domain). I automatically resize the height of my iframe so that the frame will not need any scrollbars to display the contained webpage. On Firefox and IE this works great, there is no scrollbar since I use <iframe ... scrolling="no"></iframe> . However, on webkit browsers (Safari and Chrome), the vertical scrollbar persists even when there is sufficient room for the page without the

Safari/Chrome (Webkit) - Cannot hide iframe vertical scrollbar

这一生的挚爱 提交于 2019-12-27 17:03:28
问题 I have an iframe on www.example.com that points to support.example.com (which is a CNAME to a foreign domain). I automatically resize the height of my iframe so that the frame will not need any scrollbars to display the contained webpage. On Firefox and IE this works great, there is no scrollbar since I use <iframe ... scrolling="no"></iframe> . However, on webkit browsers (Safari and Chrome), the vertical scrollbar persists even when there is sufficient room for the page without the

Selenium 多表单(frame/iframe)切换

雨燕双飞 提交于 2019-12-27 14:49:03
frame标签有frameset、frame、iframe三种,frameset跟其他普通标签没有区别,不会影响到正常的定位,而frame与iframe需要切换进去才能定位到其中的元素 比如下面这个网页,有多个frame,以及嵌套iframe,我们在操作里面元素时,需要切换进去。 登陆后,我们要切换进leftFrame进行操作 代码: # coding = utf-8 from selenium import webdriver # 驱动文件路径 driverfile_path = r'D:\coship\Test_Framework\drivers\IEDriverServer.exe' # 启动浏览器 driver = webdriver.Ie(executable_path=driverfile_path) # 打开网页 driver.get(r'http://172.21.13.83:28080/') # 登录 driver.find_element_by_css_selector("[name='admin.loginName']").send_keys("autotest") driver.find_element_by_css_selector("[name='admin.password']").send_keys("111111") driver.find

Javascript Iframe innerHTML

孤人 提交于 2019-12-27 12:09:18
问题 Does anyone know how to get the HTML out of an IFRAME I have tried several different ways: document.getElementById('iframe01').contentDocument.body.innerHTML document.frames['iframe01'].document.body.innerHTML document.getElementById('iframe01').contentWindow.document.body.innerHTML etc 回答1: I think this is what you want: window.frames['iframe01'].document.body.innerHTML EDIT: I have it on good authority that this won't work in Chrome and Firefox although it works perfectly in IE, which is

cross-domain iframe resizer?

こ雲淡風輕ζ 提交于 2019-12-27 11:45:13
问题 I'm looking for a good cross-domain iframe resizing script that adjusts its height based on its content. I have access to the html/css for the source of the iframe as well. Is there any out there? 回答1: If your users are on modern browsers, you can solve this quite easily with postMessage in HTML5. Here's a quick solution which works well: The iframe page: <!DOCTYPE html> <head> </head> <body onload="parent.postMessage(document.body.scrollHeight, 'http://target.domain.com');"> <h3>Got post?<