简体   繁体   English

我们如何阅读`的“内容” <script>` tag?

[英]how do we read the “contents” of a `<script>` tag?

I like the JSONP where we can get info cross-domainly however, what if some services do not support JSONP (and hence do not provide a callback?) 我喜欢JSONP,但是我们可以跨域获取信息,如果某些服务不支持JSONP(因此不提供回调)怎么办?

I need a solution to this problem. 我需要解决这个问题的方法。

I'm thinking if we have a tag like this <script id="s1" source="http://other.com/asd"></script> how do we go about extracting the "contents" of s1 ? 我在想,如果我们有这样的标签<script id="s1" source="http://other.com/asd"></script> ,我们该如何提取s1的“内容”?

Initially I'd thought s1.innerHTML would do the trick but well.. apparently it doesn't do the trick. 最初,我以为s1.innerHTML可以解决问题,但是很好。

I'm wondering if anyone has any "hacks" that they would love to share. 我想知道是否有人愿意分享他们的“ hacks”。

HACKS ARE WELCOMED 欢迎大家参加

This is a security feature. 这是一项安全功能。 In the absence of any major security flaws, there's no way to perform a cross-site request without the cooperation of the site you're making the request to. 在没有任何重大安全漏洞的情况下,如果没有您要提出请求的站点的合作,就无法执行跨站点请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM