• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<title>Binding Test</title>
4<script language="JavaScript">
5
6function setup() {
7  if (location.hostname == 'tests' || location.hostname == 'localhost')
8    return;
9
10  alert('This page can only be run from tests or localhost.');
11
12  // Disable all elements.
13  var elements = document.getElementById("form").elements;
14  for (var i = 0, element; element = elements[i++]; ) {
15    element.disabled = true;
16  }
17}
18
19// Send a query to the browser process.
20function sendMessage() {
21  // Results in a call to the OnQuery method in binding_test.cc
22  window.cefQuery({
23    request: 'BindingTest:' + document.getElementById("message").value,
24    onSuccess: function(response) {
25      document.getElementById('result').value = 'Response: '+response;
26    },
27    onFailure: function(error_code, error_message) {}
28  });
29}
30</script>
31
32</head>
33<body bgcolor="white" onload="setup()">
34<form id="form">
35Message: <input type="text" id="message" value="My Message">
36<br/><input type="button" onclick="sendMessage();" value="Send Message">
37<br/>You should see the reverse of your message below:
38<br/><textarea rows="10" cols="40" id="result"></textarea>
39</form>
40</body>
41</html>
42