开发者

Firefox and Chrome do not support cross-domain AJAX by default?

开发者 https://www.devze.com 2022-12-30 08:30 出处:网络
The following code works as expected in IE8 and Safari4, but not in Firefox3.6 and Chrome. All browsers are on Windows.

The following code works as expected in IE8 and Safari4, but not in Firefox3.6 and Chrome. All browsers are on Windows.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Con开发者_开发技巧tent-Type" content="text/html; charset=UTF-8">
        <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
        <script type="text/javascript">
            $(function() { $('#tabs').tabs(); });
        </script>
    </head>
    <body>
        <div id="tabs">
            <ul>
                <li><a href="http://www.google.com/">Google</a></li>
                <li><a href="http://www.msn.com/">MSN</a></li>
            </ul>
        </div>
    </body>
</html>

Seems that Firefox and Chrome do not support cross-domain AJAX by default, right? Is there any easy way to turn on cross-domain AJAX in Firefox and Chrome?


Use JSONP (basically, you insert a <script src="otherdomain.tld/....?callback=your_function"/> (jQuery does it automagically).


can this help http://www.ajax-cross-domain.com/ ?


XSS (cross site scripting) is a big bad. Unless you're talking about making security modification to the other to make them support it, I can't believe they would by default.

Edit

I just noticed that the code you have there isn't doing any XSS though. What kind of errors (if any) are you getting from this?

0

精彩评论

暂无评论...
验证码 换一张
取 消