Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonp的原理 #49

Closed
Seasons123 opened this issue Jul 21, 2017 · 0 comments
Closed

jsonp的原理 #49

Seasons123 opened this issue Jul 21, 2017 · 0 comments

Comments

@Seasons123
Copy link
Owner

  1. 同源策略限制,ajax无法发送跨域请求
  2. 一些HTML标签天生拥有跨域请求能力,如<script><iframe>
  3. 用动态生成<script>节点的方式来发起跨域请求
  4. 请求时需要将回调的函数名称发送后服务端
  5. 服务端用接收到的函数名称包裹数据给前端返回
  6. 像jquery实现的jsonp,会自动生成有唯一标识的函数名,不必自己操心
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant