<!DOCTYPE html><html><head><style type="text/css">"body { font-family:'Times New Roman'; font-size:13px"}</style></head><body><div><font face="Verdana">Hi, I'm a GCI student, and recently wrote this document for one of the assignments.&nbsp;</font><br></div><div><font face="Verdana"><br></font></div><div><font face="Verdana"><big>Embedding the Parrot VM into Mozilla Firefox</big><br></font></div><div><font face="Verdana"><br>&nbsp;Placing a new interpreter into Firefox is something that, to me, seems very important, but as far as I know has never been attempted before.  However, I see a very strait forward way of implementing this as a windowed, scriptable* plug-in.  Why a plug-in?  For one, it is much simpler for both the developer and the user, because the developer gets to use the API for plug-ins (NPAPI),which is well maintained and well documented on the Mozilla Developer Network <a href="https://developer.mozilla.org/en/Gecko_Plugin_API_Reference">here</a>, while not having to search though the source code, edit it, and A. Create a new version of Firefox or B. Try and confince enough people at Mozilla to include it.  And, for the user, all they have to worry about is installing a plug-in.  Plus, (a very large, encouraging plus) NPAPI is already supported by:</font><font face="Verdana"><br></font><blockquote><font face="Verdana">Epiphany, Google Chrome, Safari, Konqueror, Mozilla project applications, Netscape Navigator and Communicator, Opera, and Internet Explorer up to 5.5SP2 (so sad that IE can't seem to properly support much anything standardized, except maybe <a href="http://mrdoob.com/128/IE6_HTML5">hyperlinks</a>...)<br></font></blockquote><font face="Verdana"><br>Also good is that that Parrot itself seems to made out of parrot file types and C/C++ files to interpret those (at least on the windows port),and the NPAPI is C, which should mean only a couple files added to parrot and probably some minor edits.</font></div><div><font face="Verdana"><br>Now, there are many ways to use a (scriptable) plug-in from a web page, all using the &lt;embed&gt; and &lt;object&gt; tags.  To activate from a web page, one could do some thing like this:</font></div><div><font face="'Courier New',monospace"><br></font></div><div><font face="'Courier New',monospace">&lt;embed type="application/x-parrot-perl" id="perlObj"&gt;&lt;/embed&gt;<br></font><font face="'Courier New',monospace">&lt;!--The browser doesn't recognise x-parrot-perl nativly, searchs internally for it--&gt;<br></font><font face="'Courier New',monospace"><br></font><font face="'Courier New',monospace">&lt;div style="display:none" id="myString"&gt;<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;&lt;!--some perl code--&gt;<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;&lt;!--this is should allow for multiline code--&gt;<br></font><font face="'Courier New',monospace">&lt;/div&gt;<br></font><font face="'Courier New',monospace"><br></font><font face="'Courier New',monospace">&lt;script type="application/javascript"&gt;<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;var myString = document.getElementById('myString').innerTEXT<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;myString.replace('&lt;br /&gt;', '\n');<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;getElementById("perlObj").code(myString)<br></font><font face="'Courier New',monospace">&nbsp;    &nbsp;//calls the made-up parrot function code() and passes a string of code to it.<br></font><font face="'Courier New',monospace">&lt;/script&gt;</font><font face="Verdana"><br></font><font face="Verdana"><br>If I'm right, because it doesn't know it by default, the browser should look internally for a plug-in that accepts this MIME type which shall be, of course, parrot.  The code function simply and unsurprisingly would take the string sent to the plug-in and interpret it as, in this case, Perl.(there are different ways to go about the above, but the way I gave seems to be the most effective form what I've looked at)<br><br>The plug-in itself another thing indeed.  As said in the reference/documentation, Mozilla hosts files that give a starting point as samples for creating a plug-in here. Although I don't know C, they seems very simple to configure and take example from.<br><br> Whatever the parrot community chooses to do, I can't wait.<br><br>*windowed and scriptable simply mean that the plug-in has a space to draw onto and that it can be accessed via javascript<br></font></div></body></html>