3 <title>Initial Title
</title>
5 var QueryString = function() {
6 // Allows access to query parameters on the URL; e.g., given a URL like:
7 // http://<server>/my.html?test=123&bob=123
8 // Parameters can then be accessed via QueryString.test or QueryString.bob.
10 // RegEx to split out values by &.
11 var r
= /([^&=]+)=?([^&]*)/g;
12 // Lambda function for decoding extracted match values. Replaces '+' with
13 // space so decodeURIComponent functions properly.
14 function d(s
) { return decodeURIComponent(s
.replace(/\+/g, ' ')); }
16 while (match
= r
.exec(window
.location
.search
.substring(1)))
17 params
[d(match
[1])] = d(match
[2]);
21 var mimeType
= QueryString
.mimetype
;
24 var child
= document
.createElement('div');
25 child
.innerHTML
= '<object type="' + mimeType
+ '" id="plugin" border=1>' +
26 ' <b>You should not see this text!</b>' +
28 document
.getElementById('content').appendChild(child
);
29 // Plugins are loaded synchronously during layout, so the plugin has either
30 // been loaded or blocked at this point.
31 var plugin
= document
.getElementById('plugin');
33 // All Pepper plugins support postMessage().
34 // If postMessage is undefined, the plugin is not loaded.
35 if (plugin
.postMessage
== undefined) {
36 document
.title
= 'Not Loaded';
40 plugin
.postMessage('hello');
41 // If we do not get an exception, the Pepper plugin is loaded.
42 document
.title
= 'Loaded';
44 var errorMessage
= 'Unexpected Exception: ' + e
.toString();
45 document
.title
= errorMessage
;
46 console
.log(errorMessage
);
51 <body onload='inject();'
>
52 <div id='content'
></div>