Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 动态脚本黑客回调_Javascript_Cross Domain - Fatal编程技术网

Javascript 动态脚本黑客回调

Javascript 动态脚本黑客回调,javascript,cross-domain,Javascript,Cross Domain,我有一个只包含字符串的页面,需要从另一个域中的页面读取它。我曾尝试通过动态脚本破解(以避免安全限制)来实现这一点,并且可以读取该字符串,但无法将其引入回调以在变量中继续使用 我的问题是,我只需要使用javascript就可以了 以下是我当前使用的代码: index.html: <html> <head> <script type="text/javascript"> function xss_ajax(url) { var script

我有一个只包含字符串的页面,需要从另一个域中的页面读取它。我曾尝试通过动态脚本破解(以避免安全限制)来实现这一点,并且可以读取该字符串,但无法将其引入回调以在变量中继续使用

我的问题是,我只需要使用javascript就可以了

以下是我当前使用的代码:

index.html:

<html>
<head>
<script type="text/javascript">
    function xss_ajax(url) {
        var script_id = null;
        var script = document.createElement('script');
        script.setAttribute('type', 'text/javascript');
        script.setAttribute('src', url);
        script.setAttribute('id', 'script_id');

        script_id = document.getElementById('script_id');
        if(script_id){
            document.getElementsByTagName('head')[0].removeChild(script_id);
        }

        document.getElementsByTagName('head')[0].appendChild(script);
    }

    var url = "http://otherdomain.com/ping.html";

    xss_ajax(url);
</script>
</head>
<body>
</body>
</html>
1|1739

非常感谢并抱歉我的英语。

如果您说,您从
ping.html
得到的结果没有定义任何变量

使物体像

   result = [1,1739];
在index.html中声明

var result = [];
那你就可以用它了