1. 项目地址:
https://github.com/krakenjs/xcomponent
2. 支持的特性
a. Render an iframe or popup on a different domain, and pass down props, including objects
and functions
b. Call callbacks natively from the child window without worrying about post-messaging or
cross-domain restrictions
c. Create and expose components to share functionality from your site to others!
3. 简单使用
// Define a component:
var MyLoginComponent = xcomponent.create({ tag: 'my-login-component',
url: 'http://www.my-site.com/my-login-component'
});
// Render the component on the parent page:
MyLoginComponent.render({ prefilledEmail: 'foo@bar.com', onLogin: function(email) {
console.log('User logged in with email:', email);
} }, '#container'); //Implement the component in the iframe: <input type="text" id="email" />
<input type="password" id="password" />
<button id="login">Log In</button> <script>
var email = document.querySelector('#email');
var password = document.querySelector('#password');
var button = document.querySelector('#login'); email.value = window.xprops.prefilledEmail; button.addEventListener('click', function() {
if (validUser(email.value, password.value)) {
window.xprops.onLogin(email.value);
}
});
</script>
4.  参考资料
https://github.com/krakenjs/xcomponent
https://github.com/krakenjs/xcomponent/blob/master/docs/api.md
 
 
 
 

xcomponent web 跨域组件介绍的更多相关文章

  1. web跨域访问,session丢失的问题

    web跨域访问,session丢失的问题25 http://www.iteye.com/problems/71265 http://www.iteye.com/topic/264079 具体情况如下: ...

  2. Web跨浏览器进程通信(Web跨域)

    Web跨域已是老生常谈的话题,这次来尝试下跨域浏览器进程之间的通信 —— 这在过去基本依靠网络中转实现   在之前一篇文章里尝试了跨浏览器的数据共享,最后提到使用LocalConnection还可以实 ...

  3. web跨域及cookie相关知识总结

    原文:web跨域及cookie相关知识总结   之前对于跨域相关的知识一致都很零碎,正好现在的代码中用到了跨域相关的,现在来对这些知识做一个汇总整理,方便自己查看,说不定也可能对你有所帮助. 本篇主要 ...

  4. web跨域问题回顾

    晚上看spring web源码时看到了cors包,查了一下原来是在4.2之后新加的用来更方便让web应用服务支持cors协议的.于是有了下面几个问题. web跨域问题的起源是因为浏览器为了安全而遵循的 ...

  5. java web 跨域

    服务器端解决跨域问题的三种方法   跨域是指html文件所在的服务器与ajax请求的服务器是不同的ip+port,例如: - ‘192.168.1.1:8080’ 与 ‘192.168.1.2:808 ...

  6. 浅谈WEB跨域的实现(前端向)

    同源策略/SOP(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,浏览器很容易受到XSS.CSFR等攻击(可以参考我的这篇文章). SOP要求 ...

  7. Web跨域问题总结

    一.跨域问题的由来为了防止某些文档或脚本加载别的域下的未知内容造成泄露隐私,破坏系统等安全行为,1995年, Netscape 公司在浏览器中引入同源策略/SOP(Same origin policy ...

  8. web跨域解决方案

    阅读目录 什么是跨域 常用的几种跨域处理方法: 跨域的原理解析及实现方法 总结 摘要:跨域问题,无论是面试还是平时的工作中,都会遇到,本文总结处理跨域问题的几种方法以及其原理,也让自己搞懂这方面的知识 ...

  9. WEB跨域的实现

    同源策略/SOP(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,浏览器很容易受到XSS.CSFR等攻击(可以参考我的这篇文章). SOP要求 ...

随机推荐

  1. Chemistry

    Problem A. Chemistry Input file: chemistry.in Output file: chemistry.out Time limit: 1 seconds Memor ...

  2. ARM协处理器CP15寄存器详解【转】

    本文转载i自;https://blog.csdn.net/gameit/article/details/13169405 用于系统存储管理的协处理器CP15   MCR{cond}     copro ...

  3. 正则表达式【TLCL】

    grep[global regular expression print] print lines matching a pattern grep [options] regex [file...] ...

  4. 3.scala容器

    3.scala容器 a:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-o ...

  5. UVA 1639 Candy (组合数+精度)

    题意:两个箱子,每个箱子有n颗糖,每次有p的概率拿1号箱子的一颗糖出来(有1-p的概率拿2号箱子的一颗糖出来),问当打开某个箱子为空的时候,另一个箱子的期望糖的数量是多少 题解:枚举另一个箱子的糖的数 ...

  6. 如何让Myeclipse已经关闭掉的项目不显示出来

    一.打开Package Explorer视图,在它的右上角有一个向下的三角图标. 2.点击后选择Filters,在弹出的Filter配置窗口中选中"Closed Projects" ...

  7. codeforces 814B.An express train to reveries 解题报告

    题目链接:http://codeforces.com/problemset/problem/814/B 题目意思:分别给定一个长度为 n 的不相同序列 a 和 b.这两个序列至少有 i 个位置(1 ≤ ...

  8. js进阶---12-12、jquery事件委托怎么使用

    js进阶---12-12.jquery事件委托怎么使用 一.总结 一句话总结:通过on方法(事件委托),给要绑定事件的元素的祖先绑定事件,从而达到效果. 1.事件委托是什么? 通过事件冒泡,让子元素绑 ...

  9. JQuery 全选 取消

    $('#chkAllProp').click(function () { $("input[id*='chkSelect']").prop("checked", ...

  10. 【lightoj-1046】Rider(BFS)

    链接:http://www.lightoj.com/volume_showproblem.php?problem=1046 题意: 给m*n的棋盘,数字k代表这个位置上有棋子,并且一步可以连续跳1-k ...