| <html> | |
| <head> | |
| <script language="JavaScript"> | |
| 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; | |
| } | |
| } | |
| // 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> | |
| </head> | |
| <body bgcolor="white" onload="setup()"> | |
| <form id="form"> | |
| URL: <input type="text" id="url" value="https://www.google.com"> | |
| <br/><input type="button" onclick="execURLRequest();" value="Execute CefURLRequest"> | |
| <br/><textarea rows="10" cols="40" id="ta"></textarea> | |
| </form> | |
| </body> | |
| </html> |