chromium/chrome/test/data/load_pepper_plugin.html

<html>
<head>
<title>Initial Title</title>
<script>
var QueryString = function() {
  // Allows access to query parameters on the URL; e.g., given a URL like:
  //    http://<server>/my.html?test=123&bob=123
  // Parameters can then be accessed via QueryString.test or QueryString.bob.
  var params = {};
  // RegEx to split out values by &.
  var r = /([^&=]+)=?([^&]*)/g;
  // Lambda function for decoding extracted match values. Replaces '+' with
  // space so decodeURIComponent functions properly.
  function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
  var match;
  while (match = r.exec(window.location.search.substring(1)))
    params[d(match[1])] = d(match[2]);
  return params;
}();

var mimeType = QueryString.mimetype;

function inject() {
  var child = document.createElement('div');
  // Set data="foo" to make this content same-origin (so it's not throttled).
  child.innerHTML = '<object type="' + mimeType + '" id="plugin" data="foo">' +
                    '  <b>You should not see this text!</b>' +
                    '</object>';
  document.getElementById('content').appendChild(child);
  // Plugins are loaded synchronously during layout, so the plugin has either
  // been loaded or blocked at this point.
  var plugin = document.getElementById('plugin');
  try {
    // All Pepper plugins support postMessage().
    // If postMessage is undefined, the plugin is not loaded.
    if (plugin.postMessage == undefined) {
      document.title = 'Not Loaded';
      return;
    }

    plugin.postMessage('hello');
    // If we do not get an exception, the Pepper plugin is loaded.
    document.title = 'Loaded';
  } catch (e) {
    var errorMessage = 'Unexpected Exception: ' + e.toString();
    document.title = errorMessage;
    console.log(errorMessage);
  }
}
</script>
</head>
<body onload='inject();'>
<div id='content'></div>
</body>
</html>