iframe

前端跨域问题解决方案

谁说胖子不能爱 提交于 2019-12-26 10:26:04
背景: 同源策略:NetSpace公司引入,基于浏览器安全,防止浏览器收到XSS、CSFR等攻击。同源,即协议+域名+端口完全一致。 同源策略:为保障用户信息安全,防止恶意网站窃取数据的一种安全策略。 *** “同源”:协议相同、域名相同、端口号相同 同源策略限制的行为: Cookie、LocalStorage和IndexDB无法读取 DOM和JS对象无法获取 Ajax请求不能发送 解决方案: 方案一:JSONP 原理:通过script标签引入的js不受同源策略的限制,而XmlHttpRequest对象受到同源策略的影响。可以加载跨域服务器上的脚本,用JSONP获取的不是JSON数据,而是可以直接运行的JS脚本。 eg1:jquery function jsonpCallback(data) { console.log("jsonpCallback: " + data.name) } $.ajax({ url:"http://www.nanhuaqiushui.com:8080/login", type:"get", dataType:"jsonp", data:{ name: $("#name").val(), id: $("#id").val() }, cache: false, timeout: 5000, jsonp: "callback", /

iframe 模拟ajax文件上传and formdata ajax 文件上传

痴心易碎 提交于 2019-12-26 00:45:20
对于文件上传 有好多种方式,一直想总结 文件上传的方法 今天就来写下 iframe 的文件上传的代码 本人语言表达能里有限,不多说了 直接上代码。 首先看 总体页面。 总共就三个文件。 实际上也就是index.html 中的主要代码 index.html <html> <head> <meta charset="UTF-8"> <title>iframe无刷新上传文件</title> <link rel="stylesheet" type="text/css" href=""> </head> <body> <script type="text/javascript" src="./jquery-1.11.1.min.js"></script> <form action="./index.php" method="post" enctype="multipart/form-data" target="form-target" > //这里的的target的值必须和iframe中的name 一样。   <input type="file" name="file" id="file"> <input type="submit" value="提交"> </form>//在项目中 ifream 大家设置下样式 使其隐藏就行。 我这里为了调试方便而就不隐藏了。 <iframe name=

How to override css class set in iframe? [duplicate]

我与影子孤独终老i 提交于 2019-12-25 20:58:26
问题 This question already has answers here : How to apply CSS to iframe? (27 answers) Closed 3 years ago . I have third party iframe widget component on my page. This is all I have as an HTML string in the body of my page. This iframe brings some custom button with style set by that widget.jsp. Chrome inspector doesn't show anything else except <iframe> component. But FireFox shows that button inside <iframe> with style class ".button" <iframe src='https://www.xxxxxxxx.com/aaa/bbb/widget.jsp?par1

How to override css class set in iframe? [duplicate]

青春壹個敷衍的年華 提交于 2019-12-25 20:57:31
问题 This question already has answers here : How to apply CSS to iframe? (27 answers) Closed 3 years ago . I have third party iframe widget component on my page. This is all I have as an HTML string in the body of my page. This iframe brings some custom button with style set by that widget.jsp. Chrome inspector doesn't show anything else except <iframe> component. But FireFox shows that button inside <iframe> with style class ".button" <iframe src='https://www.xxxxxxxx.com/aaa/bbb/widget.jsp?par1

It doesn't work (html and javascript and Iframe)

时间秒杀一切 提交于 2019-12-25 19:53:15
问题 Related.. (HTML, JAVASCRIPT, Iframe) I add code into Iframe's element using javascript(Dynamically.). After I set all of things. JavaScript in Iframe doesn't work( onclick=functionName(defined inside iframe)... doesn't identify javascript function) what's wrong... this is my snippet. //initialize var destiframe = $('#tmpresult').contents(); destiframe.find('head').empty(); destiframe.find('body').empty(); //add script and style destiframe.find('head').append("<style></style>"); destiframe

Soundcloud stratus player won't dynamically add more than an individual track at a time

て烟熏妆下的殇ゞ 提交于 2019-12-25 18:31:27
问题 Thanks to other people's questions, I have gotten AJAX links to work for individual songs when clicked in the DOM. My problem is that I need to find a way to load all of the tracks under a given user's account on soundcloud. I edited the stratus.js file to make it listen for the click by using .delegate(), but I can't figure out how to call the track listing from soundcloud and load it through the given iframe. This is the stratus.js file. (function() { var $; $ = jQuery; (function($){var g,d

Selenium WebDriver [Java] How do I store the elements of an iframe in a PageFactory

江枫思渺然 提交于 2019-12-25 18:16:43
问题 I am following Page Object Model to automate a flow in one application. In one of the module I have to add a new post which have a "Title" and a "Body" field. As of now, I am able to send the text in the "Title" field as it is in the Top Window. But the "Body" is within an iframe. After passing the text in "Title" I tried to switch to the iframe before writing in the "Body". This piece of code I have written in the main file. But Selenium shows an error as org.openqa.selenium

Selenium WebDriver [Java] How do I store the elements of an iframe in a PageFactory

给你一囗甜甜゛ 提交于 2019-12-25 18:16:29
问题 I am following Page Object Model to automate a flow in one application. In one of the module I have to add a new post which have a "Title" and a "Body" field. As of now, I am able to send the text in the "Title" field as it is in the Top Window. But the "Body" is within an iframe. After passing the text in "Title" I tried to switch to the iframe before writing in the "Body". This piece of code I have written in the main file. But Selenium shows an error as org.openqa.selenium

Triggering event on change of element in unordered list in an iframe

回眸只為那壹抹淺笑 提交于 2019-12-25 17:45:24
问题 I am developing an app using node-webkit. I have an iframe which loads a webpage. The webpage has an unordered list and I would like to get a trigger if an element in the unordered list changes. <iframe id="app" src="https://www.somewebsite.com/" nwdisable nwfaketop></iframe> The unordered list does not have a class name and its only tag is data-reactid="XYZ" . However the first item in the unordered list always has a class name: .abc From another SO question (Call jquery function when <ul>

Adjust Height of iFrame When New Content is Loaded

扶醉桌前 提交于 2019-12-25 16:26:08
问题 I have an iFrame that is included in my HTML and is available when the page loads. When the page first loads, the iFrame has no content/src. I am using jQuery to insert content into the iFrame dynamically. When a user clicks a link on my page, the contents of the iFrame are updated. All of this is working for me. However, I am struggling to adjust the height of the iFrame when new content is loaded. I have tried several solutions on StackOverflow but with no success. Here is my iFrame code: