iframe

Opening different iframe depending on different button click

人盡茶涼 提交于 2020-02-25 13:11:06
问题 i am trying to open different iframe windows by assigning iframe src to a variable , when the page initially loads it should show only two buttons on the page , when i click on the button , an iframe should get loaded depending on which button is pressed , i tried doing something like this to create buttons and creating iframes , but it is not working <button id="b1">Button 1</button> <button id="b2">Button 2</button> <iframe scrolling="no" src="whatnext"> </iframe> <script> var b1 = document

Iframe occasionally loses session cookies

删除回忆录丶 提交于 2020-02-25 06:22:04
问题 Occasionally on submitting a payment form in an iframe, the postback from the payment gateway results in the user being logged out as the request is missing the ASP.NET_SessionId cookie (we are using state-server). It's not the app pool recycling causing the issue as I have checked those logs. It also only happens in the production environment. I can see the session cookie exists just before the form is submitted so I can't figure out where it is losing it. 回答1: You need to check if you are

iframe的操作switch_to_frame使用方法.

£可爱£侵袭症+ 提交于 2020-02-25 02:03:30
iframe的操作switch_to_frame使用方法. 一、frame和iframe区别 Frame与Iframe两者可以实现的功能基本相同,不过Iframe比Frame具有更多的灵活性。 frame是整个页面的框架,iframe是内嵌的网页元素,也可以说是内嵌的框架 Iframe标记又叫浮动帧标记,可以用它将一个HTML文档嵌入在一个HTML中显示。它和Frame标记的最大区别是在网页中嵌入 的<Iframe></Iframe>所包含的内容与整个页面是一个整体,而<Frame>< /Frame>所包含的内容是一个独立的个体,是可以独立显示的。另外,应用Iframe还可以在同一个页面中多次显示同一内容,而不必重复这段内 容的代码。 二、163登录界面 1.打开http://mail.163.com/登录页面10 2.用firebug定位登录框 3.鼠标停留在左下角(定位到iframe位置)时,右上角整个登录框显示灰色,说明iframe区域是整个登录框区域 4.左下角箭头位置显示iframe属性<iframe id="x-URS-iframe" frameborder="0" name="" 三、切换iframe 1.由于登录按钮是在iframe上,所以第一步需要把定位器切换到iframe上 2.用switch_to_frame方法切换,此处有id属性,可以直接用id定位切换 四

iframe中子父页面跨域通讯

廉价感情. 提交于 2020-02-24 21:59:21
目录 #跨域发送信息 #跨域接收信息 #示例Demo 在非跨域的情况下,iframe中的子父页面可以很方便的通讯,但是在跨域的情况下,只能通过 window.postMessage() 方法来向其他页面发送信息,其他页面要通过 window.addEventListener() 监听事件来接收信息; #跨域发送信息 #window.postMessage()语法 otherWindow.postMessage(message, targetOrigin, [transfer]); otherWindow 其他窗口的一个引用,写的是你要通信的window对象。 例如:在iframe中向父窗口传递数据时,可以写成window.parent.postMessage(),window.parent表示父窗口。 message 需要传递的数据,字符串或者对象都可以。 targetOrigin 表示目标窗口的源,协议+域名+端口号,如果设置为“*”,则表示可以传递给任意窗口。在发送消息的时候,如果目标窗口的协议、域名或端口这三者的任意一项不匹配targetOrigin提供的值,那么消息就不会被发送;只有三者完全匹配,消息才会被发送。例如: window.parent.postMessage('hello world',' http://xxx.com:8080/index.html ')

How to create a button in javascript that will open iframe when user clicks on that button?

三世轮回 提交于 2020-02-24 12:13:11
问题 I'm working on comments for posts on my website. How to create a button in javascript that will open iframe window with comments when user clicks on that button? Something like Facebook have with their comments on posts. If there is a way to create this with other language I would like that you write it. I just wrote javascript because I heard that you can do that in javascript. If there is a more elegant and/or better way feel free to write it. So below every posts I would add a button and

Retrieve PDF from iframe

↘锁芯ラ 提交于 2020-02-24 10:49:35
问题 Is it possible to retrieve a PDF from an iframe and submit it back to the server? My use case is to display a PDF form to the user, and let them submit the form after filling it out. I haven't found anything indicating this is possible, but I'm remaining hopeful for the moment. 回答1: You can add a submit button inside the PDF itself while generating it, and treat the data comming from your PDF form in the same way you would deal with an HTML form. In order to achieve this, you will need to add

Retrieve PDF from iframe

那年仲夏 提交于 2020-02-24 10:49:09
问题 Is it possible to retrieve a PDF from an iframe and submit it back to the server? My use case is to display a PDF form to the user, and let them submit the form after filling it out. I haven't found anything indicating this is possible, but I'm remaining hopeful for the moment. 回答1: You can add a submit button inside the PDF itself while generating it, and treat the data comming from your PDF form in the same way you would deal with an HTML form. In order to achieve this, you will need to add

Refused to display in a frame , because it set 'X-Frame-Options' to 'SAMEORIGIN'

£可爱£侵袭症+ 提交于 2020-02-23 04:41:08
问题 I am developing a website that include a simple iframe <iframe src="" frameborder="0" scrolling="no" id="product" width="100%" height="100%"></iframe> I have this error message in the console: Refused to display 'http://fr.allsaints.com/women/shop-accessories/allsaints-rally-keyfob/?colour=42&category=700' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. How can I do to display it? 回答1: You can ask whomever runs that website to grant you permission to frame it. There's no way to

【100例】iframe版的管理后台

血红的双手。 提交于 2020-02-23 02:27:01
  我使用的是LayUI做前端框架,原因很简单,网上现成代码,上手简单,自由度高,效果齐全,就官网的文档还是不够好,很多好东西都没列出来,要靠自己挖掘。   现在我准备用官网的iframe版做个管理系统后台,之前已经写过一个单页版的,需求分析已经写好,页面大概50页,8个功能模块,1个公共模块,1个登录。   看代码前,先记录一下页面3个基本方法:layui.config、layui.extend、layui.define   layui.config:初始化配置,可以把固定js,主题和use需要的扩展模块都包含进来。(目前就觉得有这个做法)   layui.extend:指定自己的路径   layui.define:定义自己的组件,也能使用里面的组件,跟layui.use有点像   再提一点,官方建议线上调用layer.all.js,可以免去调用组件,直接使用。听起来不错。   好了,下面是代码部分: html代码 <!--head-->    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> <link rel="stylesheet" href="/scripts/layui

前端安全问题及解决办法

白昼怎懂夜的黑 提交于 2020-02-22 18:47:53
前端安全问题及解决办法 xss(Cross-site Scripting)脚本注入攻击 核心:恶意脚本注入 描述:攻击者通过在目标网站上注入恶意脚本,使之在用户的浏览器上运行。利用这些恶意脚本,攻击者可获取用户的敏感信息如 Cookie、SessionID 等,进而危害数据安全。 解决方案: 1、打开npmjs.com下载xss插件,引入xss插件之后就没有任何问题了。 2、将html进行内容转换,或者将 var HtmlUtil = { /*1.用浏览器内部转换器实现html转码*/ htmlEncode:function (html){ //1.首先动态创建一个容器标签元素,如DIV var temp = document.createElement ("div"); //2.然后将要转换的字符串设置为这个元素的innerText(ie支持)或者textContent(火狐,google支持) (temp.textContent != undefined ) ? (temp.textContent = html) : (temp.innerText = html); //3.最后返回这个元素的innerHTML,即得到经过HTML编码转换的字符串了 var output = temp.innerHTML; temp = null; return output; }, /*2