iframe表单跨域访问
来源:互联网 发布:Green VPN网络加速器 编辑:程序博客网 时间:2024/05/23 11:57
<%@page language="java" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title></title>
<script src="jquery-1.8.2.min.js" type="text/javascript"></script>
</head>
<body>
<input type="hidden" id="username" value="${param.username}"/>
<input type="hidden" id="password" value="${param.password}"/>
<input type="hidden" id="backurl" value="http://open.sylai.com/oauth2/auth?client_id=hongware&redirect_uri=http://localhost:8080/wd_callback&response_type=code&scope=user,weixin,wd"/>
<input type="hidden" id="client_id" value="hongware"/>
</body>
</html>
<script type="text/javascript">
$(function(){
smal_send();
});
function smal_send(){
//取值
var user = $("#username").val();
var pass = $("#password").val();
var backurl = $("#backurl").val();
var client_id=$('#client_id').val();
//创建一个form表单
var form =$("<form action='http://api.sylai.com/v1/login' method='post'>" +
"<input type='hidden' name='username' value=''/> " +
"<input type='hidden' name='password' value=''/> " +
"<input type='hidden' name='client_id' value=''/> " +
"</form> ");
//删除id=“SML”的元素
$( "#SMAL" ).remove();
//向每个匹配元素内部插入内容
$( "body").append("<iframe id='SMAL' name='SMAL' src='http://api.sylai.com/v1/logout'></iframe>");
//执行次函数
(function(){
//查找匹配元素内部所有的子节点(包括文本节点),如果元素是一个iframe,则查找文档内容 往一个空框架中加些内容
$( "#SMAL" ).contents().find('body').html(form);
$( "#SMAL" ).contents().find("form input[name='username']").val(user);
$( "#SMAL" ).contents().find("form input[name='password']").val(pass);
$( "#SMAL" ).contents().find("form input[name='client_id']").val(client_id);
$( "#SMAL" ).contents().find('form').submit();
}());
//延迟100毫秒之后执行函数
setTimeout(function(){
window.location.href=backurl;
},100)
}
</script>
- iframe表单跨域访问
- iframe跨域访问
- iframe跨域访问
- iframe跨域访问
- iframe跨域访问
- iframe跨域访问
- iframe跨域访问
- iframe跨域访问
- Iframe跨域访问
- iframe跨域访问问题
- iframe跨域互相访问
- iframe跨域访问cookie、Session
- iframe中页面跨域访问javascript
- JS跨域访问操作iframe
- JS跨域访问操作iframe
- iframe用法 及 跨域访问问题
- IE中iframe跨域访问
- iframe 跨域访问以及操作
- Cocos2dx 3.0 过渡篇(十六)用ClippingNode做游戏的新手引导
- 后缀数组 学习笔记
- 【leetcode题解】2 - Word Search
- android webkit 图片解码
- VS2010+Opencv+MFC读取图像和视频显示在Picture控件(改进)
- iframe表单跨域访问
- VC程序运行时间测试
- Eclipse安装SVN插件方式简明介绍
- 递归算法
- 南阳 915 +-字符串
- VS2010中使用ffmpeg
- MyEclipse中如何去掉Struts2-Hibernate-Spring框架
- java中通过反射强力获取私有变量的值
- Android 获取组件高度;