xcomponent web 跨域组件介绍
https://github.com/krakenjs/xcomponent
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!
// 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>
https://github.com/krakenjs/xcomponent
https://github.com/krakenjs/xcomponent/blob/master/docs/api.md
xcomponent web 跨域组件介绍的更多相关文章
- web跨域访问,session丢失的问题
web跨域访问,session丢失的问题25 http://www.iteye.com/problems/71265 http://www.iteye.com/topic/264079 具体情况如下: ...
- Web跨浏览器进程通信(Web跨域)
Web跨域已是老生常谈的话题,这次来尝试下跨域浏览器进程之间的通信 —— 这在过去基本依靠网络中转实现 在之前一篇文章里尝试了跨浏览器的数据共享,最后提到使用LocalConnection还可以实 ...
- web跨域及cookie相关知识总结
原文:web跨域及cookie相关知识总结 之前对于跨域相关的知识一致都很零碎,正好现在的代码中用到了跨域相关的,现在来对这些知识做一个汇总整理,方便自己查看,说不定也可能对你有所帮助. 本篇主要 ...
- web跨域问题回顾
晚上看spring web源码时看到了cors包,查了一下原来是在4.2之后新加的用来更方便让web应用服务支持cors协议的.于是有了下面几个问题. web跨域问题的起源是因为浏览器为了安全而遵循的 ...
- java web 跨域
服务器端解决跨域问题的三种方法 跨域是指html文件所在的服务器与ajax请求的服务器是不同的ip+port,例如: - ‘192.168.1.1:8080’ 与 ‘192.168.1.2:808 ...
- 浅谈WEB跨域的实现(前端向)
同源策略/SOP(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,浏览器很容易受到XSS.CSFR等攻击(可以参考我的这篇文章). SOP要求 ...
- Web跨域问题总结
一.跨域问题的由来为了防止某些文档或脚本加载别的域下的未知内容造成泄露隐私,破坏系统等安全行为,1995年, Netscape 公司在浏览器中引入同源策略/SOP(Same origin policy ...
- web跨域解决方案
阅读目录 什么是跨域 常用的几种跨域处理方法: 跨域的原理解析及实现方法 总结 摘要:跨域问题,无论是面试还是平时的工作中,都会遇到,本文总结处理跨域问题的几种方法以及其原理,也让自己搞懂这方面的知识 ...
- WEB跨域的实现
同源策略/SOP(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,浏览器很容易受到XSS.CSFR等攻击(可以参考我的这篇文章). SOP要求 ...
随机推荐
- BeatSaber节奏光剑插件开发官方教程2-简单的插件示例
原文:https://wiki.assistant.moe/modding/example-mod 一.在开始之前 1 确保你已经看过教你如何添加插件模板的教程,且你已经使用插件模板创建了一个新项目 ...
- mysql 5.6 设置root初始密码正确步骤,避免入坑
http://blog.csdn.net/lw_power/article/details/47368167
- CentOS限制SSH登录地址
编辑hosts.allow文件,将允许连接的地址写进去 [root@Elements ~]# vim /etc/hosts.allow sshd:10.10.10.1:allow sshd:172.1 ...
- no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
1. 使用git克隆项目报错 $ git clone ssh://liuchao@192.168.7.32:29418/platform/Midou Cloning into 'Midou'... U ...
- sql报字段过大的错误解决方法
set global max_allowed_packet = 2*1024*1024*10
- PHP5+APACHE2.2配置
注意这里用的是PHP5.3版本 在Windows系统上使用Apache2.2上模块化安装PHP5.3 PHP5.3增加了一些功能,如namespace,静态迟绑定等. 本篇文章将帮您如何安装PHP5. ...
- Ceph 纠删码介绍
http://ceph.org.cn/2016/08/01/ceph-%E7%BA%A0%E5%88%A0%E7%A0%81%E4%BB%8B%E7%BB%8D/
- codeforces 814B.An express train to reveries 解题报告
题目链接:http://codeforces.com/problemset/problem/814/B 题目意思:分别给定一个长度为 n 的不相同序列 a 和 b.这两个序列至少有 i 个位置(1 ≤ ...
- 智课雅思词汇---二十五、形容词后缀-ate-fic-ose-ulent-olent-ous-ulous-y
智课雅思词汇---二十五.形容词后缀-ate-fic-ose-ulent-olent-ous-ulous-y 一.总结 一句话总结: 1.形容词后缀-ate(determinate)? determi ...
- MVVM架构说明1
MVVM是Model-View-ViewModel的简写.微软的WPF带来了新的技术体验,如Sliverlight.音频.视频.3D.动画……,这导致了软件UI层更加细节化.可定制化.同时,在技术层面 ...