2015-02-14 00:17:08 +01:00
|
|
|
<html>
|
2017-11-09 20:00:47 +01:00
|
|
|
<head>
|
2015-02-14 00:17:08 +01:00
|
|
|
<script language="JavaScript">
|
|
|
|
|
2017-11-09 20:00:47 +01:00
|
|
|
function setup() {
|
|
|
|
if (location.hostname == 'tests' || location.hostname == 'localhost')
|
|
|
|
return;
|
|
|
|
|
|
|
|
alert('This page can only be run from tests or localhost');
|
|
|
|
|
|
|
|
// Disable all elements.
|
|
|
|
var elements = document.getElementById("form").elements;
|
|
|
|
for (var i = 0, element; element = elements[i++]; ) {
|
|
|
|
element.disabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
// Send a query to the browser process.
|
|
|
|
function execURLRequest() {
|
|
|
|
document.getElementById('ta').value = 'Request pending...';
|
|
|
|
|
|
|
|
// Results in a call to the OnQuery method in urlrequest_test.cpp
|
|
|
|
window.cefQuery({
|
|
|
|
request: 'URLRequestTest:' + document.getElementById("url").value,
|
|
|
|
onSuccess: function(response) {
|
|
|
|
document.getElementById('ta').value = response;
|
|
|
|
},
|
|
|
|
onFailure: function(error_code, error_message) {
|
|
|
|
document.getElementById('ta').value = 'Failed with error ' + error_message + ' (' + error_code + ')';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2017-11-09 20:00:47 +01:00
|
|
|
</head>
|
|
|
|
<body bgcolor="white" onload="setup()">
|
|
|
|
<form id="form">
|
2023-01-03 19:53:40 +01:00
|
|
|
URL: <input type="text" id="url" value="https://www.google.com">
|
2015-02-14 00:17:08 +01:00
|
|
|
<br/><input type="button" onclick="execURLRequest();" value="Execute CefURLRequest">
|
|
|
|
<br/><textarea rows="10" cols="40" id="ta"></textarea>
|
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|