Tag: iframe

为什么使用ReactTestUtils将iframe渲染成jsdom不提供contentWindow?

我试图testing一个呈现iframe的React组件,并直接向该iframe注入标记。 (我不想在iframe中加载一个URL。) 该组件实际上在浏览器中运行得非常好,但是迄今为止对其进行testing似乎是不可能的。 我不知道为什么。 这是一个缩短的testing用例,certificate失败。 // Set up DOM var jsdom = require( 'jsdom' ).jsdom; global.document = jsdom( '' ); global.window = document.defaultView; global.navigator = document.defaultView.navigator; // Prepare React var ReactTestUtils = require( 'react-addons-test-utils' ); var React = require( 'react' ); var Frame = React.createClass( { componentDidMount() { console.log( 'iframe loaded. adding content' ); const […]

使用带有Reactjs的YouTubes JS API呈现iFramevideo

我试过四处寻找例子,但我所有的是youtube-react npm包,我不想要,因为我想要做,并自己学习。 我的问题是在这里的文档: https : //developers.google.com/youtube/iframe_api_reference它告诉我提供一个锚标签为谷歌添加iFrame根据你传递它。 然而,我已经在服务器端做出反应,并使用web-pack将其编译到客户端,我的反应组件到目前为止如下所示: import React from 'react'; import { Link } from 'react-router' import classnames from 'classnames' const videoId = 'XxVg_s8xAms'; export default React.createClass({ getInitialState: function() { return { YTid: videoId, } }, render() { return ( <section className="youtubeComponent-wrapper"> <div id="youtubePlayerAnchor"></div> </section> ) } }) 我已经尝试从开发人员的文档添加到客户端的script标记中的代码,但没有任何事情在控制台没有任何事情发生。 有没有任何资源,或任何人都可以指出我正确的方向,我将如何去处理这个问题。 谢谢!

服务器可以检查请求是否来自iframe(Node.js)?

我希望我的服务器能够检查来自iframe的请求 如果请求来自iframe,我希望我的服务器能够find该iframe的父域的域名 是否有上述可能,如果是的话,我怎么能在Node.js / Express.js服务器中实现这样的检查? 预先感谢您的任何帮助

获取variables从configuration文件到浏览器

我有一个相当复杂的设置,它要求networking浏览器本地存储具有计算机的名称填充,以使应用程序正常工作。 为了做到这一点,我从configuration文件中读取: kiosk-name: Mort 我启动我的node.js Web服务器时读取configuration文件: var filesys = require('fs'); var os = require('os'); filesys.readFile(project_path + '/kiosk.cfg', 'utf8', function(err, data) { var kioskname; if (err) { //console.log(err); kioskname = os.hostname(); } else { var configArray = data.split(':'); if('' != configArray[1]) { kioskname = configArray[1]; } else { kioskname = os.hostname(); } } }); 所有这些按照devise工作,当configuration文件未被填充时,使用计算机的os.hostname()作为默认值。 客户端具有一个基本页面(index.html),它将一个默认页面(default.html)加载到一个iframe […]

无法使用phantomJS获取iframe的元素

我正在寻找一种方法来控制文档中的元素。 问题是,该文件被附加到一个iFrame。 这是一个例子: .goto('https://wirecard-sandbox-engine.thesolution.com/engine/hpp/') .use(iframe.withFrameName('wc', function (nightmare) { nightmare .type('#account_number', accountNumber) .screenshot(resultfolder + '\\06-Card-Number.png') .type('#card_security_code', testData.securityCode) .selectIndex('#expiration_month_list', 1) .selectIndex('#expiration_year_list', 4) .click('span[id="hpp-form-submit"]') })) 我在上面要做的是: 获取与url的iFrame。 使用这个来获得对iFrame中每个元素的控制。

通过Node.JS修改IFRAME上的X-Frame选项?

是否有可能修改Node.JS应用程序中的IFRAME的响应头? 你必须先创build一个代理? (类似于这个? http://www.bennadel.com/blog/2179-Extending-EventEmitter-In-Order-To-Create-A-Response-Proxy-In-Node-js.htm ) 我基本上希望能够在IFRAME中显示Gmail的移动版本。

尝试呈现i帧:祖先违反了以下内容安全策略指令:“frame-ancestors'none'”

我想呈现一个iframe的来源是Github像这样: <iframe src="https://gist.github.com/user45445/9bf8d568e3350146ba302d7d67ad576f"> </iframe> 这是我在控制台中得到的错误: Refused to display 'https://gist.github.com/fresh5447/9bf8d568e3350146ba302d7d67ad576f' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'". 我正在研究如何在我的Node服务器中指定我的Content Security Policy ,指定它应该接受来自github任何iframe 所以我安装了csp-helmet,并将其添加到我的服务器代码中: var csp = require('helmet-csp') app.use(csp({ // Specify directives as normal. directives: { frameAncestors: ['*.github.com'], //I thought these two did the same, so I tried them both. […]

select嵌套的iframe – selenium / javascript / node-js

我想用node-js中的selenium webdriver模块在iframe中select一个嵌套的iframe。 例如: <iframe id="firstframe"> <div id="firstdiv"></div> <iframe id="secondframe"> <div id="seconddiv"></div> </iframe> </iframe> 对于node-js部分: driver.switchTo().defaultContent(); driver.switchTo().frame("firstframe"); // –> works driver.switchTo().frame("secondframe"); // –> NoSuchFrameError iframes = driver.findElements(webdriver.By.tagName('iframe')).then(function(elements){ console.log(elements.length); // –> if I put this code before the switch to first frame output: 1, if I put it after output: 0) }); 我尝试使用索引号,但这也失败了。 编辑: 好吧,我想通了,但我的答案由于某种原因被用户@casparOne删除。 如果有人仍然想知道这里的问题是什么: 我的代码上面的作品,只是不在本地。 […]

节点webkit – 从父窗口捕获iframe鼠标事件

我试图在我的应用程序中创build一个可拖动的iframe。 当iframe被聚焦时,所有的鼠标事件都在内部窗口对象内被触发。 我不能听iframe中的这些事件,并自己触发它们,因为它可以被iframe内容js阻止 我不能在iframe上创build一个不可见的层,它将捕获所有的事件,并将其移动到iframe,因为bultin事件不能被脚本触发(如css hover ) 我可以在Node层捕获这些事件,而不使用webkit DOM?