12345678910111213141516171819202122232425262728293031 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset='utf-8'>
- <style>
- body {
- margin: 0;
- }
- </style>
- </head>
- <body>
- ...
- <script>
- const testData = JSON.parse(decodeURIComponent(location.hash.substring(1)));
- const script = testData.script;
- import(testData.script).then(async Module => {
- try {
- const result = await Module.test();
- if (result) {
- document.body.innerHTML = "ok";
- parent.postMessage(JSON.stringify({ script }), "*");
- }
- } catch (error) {
- parent.postMessage(JSON.stringify({ script, error: { message: error.message, stack: error.stack } }), "*");
- throw error;
- }
- })
- </script>
- </body>
|