-
Notifications
You must be signed in to change notification settings - Fork 7
/
testpage.html
50 lines (46 loc) · 1.23 KB
/
testpage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
</head>
<body>
<p>Testing CORS:</p>
<p>
<strong id="result"></strong>
</p>
</body>
<script type="text/javascript">
// detect IE CORS transport
if ('XDomainRequest' in window && window.XDomainRequest !== null) {
// override default jQuery transport
jQuery.ajaxSettings.xhr = function() {
try { return new XDomainRequest(); }
catch(e) { alert (e.Message); }
};
// also, override the support check
jQuery.support.cors = true;
}
// now you can use jQuery to do cross-domain requests on IE8+
jQuery.ajax({
url: 'http://manu.sporny.org/rdfa/cors',
type: 'GET',
success: function(response) {
alert("response");
$("#result").text(response);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
</script>
</html>