Google 的 javascript API 如何绕过 AJAX 中的跨域安全 [英] How does Google's javascript API get around the cross-domain security in AJAX

查看:14
本文介绍了Google 的 javascript API 如何绕过 AJAX 中的跨域安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当它在您的网站上时,Google 的 API 如何将跨域请求返回给 Google?

How does Google's API make cross-domain requests back to Google, when it's on your website?

推荐答案

他们通过将脚本标签动态注入到文档的头部来解决这个问题.通过此注入发送的 javascript 中有一个回调函数,它告诉在页面中运行的脚本它已加载和有效负载(数据).

They get around it by dynamically injecting script tags into the head of the document. The javascript that is sent down via this injection has a callback function in it that tells the script running in the page that it has loaded and the payload (data).

脚本然后可以删除动态注入的脚本标记并继续.

The script can then remove the dynamically injected script tag and continue.

这篇关于Google 的 javascript API 如何绕过 AJAX 中的跨域安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆