mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-13 10:06:28 +01:00
262ed72348
Some features that we wish to test require HTTPS. Also, Chrome runtime is redirecting HTTP URLs to HTTPS due to HSTS.
40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
<html>
|
|
<body bgcolor="white">
|
|
<script language="JavaScript">
|
|
function execXMLHttpRequest()
|
|
{
|
|
var url = document.getElementById("url").value;
|
|
var warningElement = document.getElementById("warning");
|
|
if (url.indexOf(location.origin) != 0) {
|
|
warningElement.innerHTML =
|
|
'For cross-origin requests to succeed the server must return CORS headers:' +
|
|
'<pre>Access-Control-Allow-Origin: ' + location.origin +
|
|
'<br/>Access-Control-Allow-Header: My-Custom-Header</pre>';
|
|
warningElement.style.display = 'block';
|
|
} else {
|
|
warningElement.style.display = 'none';
|
|
}
|
|
|
|
xhr = new XMLHttpRequest();
|
|
xhr.open("GET", url, true);
|
|
xhr.setRequestHeader('My-Custom-Header', 'Some Value');
|
|
xhr.onload = function(e) {
|
|
if (xhr.readyState === 4) {
|
|
var value = "Status Code: "+xhr.status;
|
|
if (xhr.status === 200)
|
|
value += "\n\n"+xhr.responseText;
|
|
document.getElementById('ta').value = value;
|
|
}
|
|
}
|
|
xhr.send();
|
|
}
|
|
</script>
|
|
<form>
|
|
URL: <input type="text" id="url" value="https://tests/request">
|
|
<br/><input type="button" onclick="execXMLHttpRequest();" value="Execute XMLHttpRequest">
|
|
<br/><textarea rows="10" cols="40" id="ta"></textarea>
|
|
</form>
|
|
<div id="warning" style="display:none;font-weight:bold;"></div>
|
|
</body>
|
|
</html>
|