This site requires JavaScript, please enable it in your browser!
Greenfoot back
RobbieThompson
RobbieThompson wrote ...

2013/12/4

Embed Game in web page

RobbieThompson RobbieThompson

2013/12/4

#
Hello, I am wondering how I embed a Greenfoot game inside a webpage as seen on http://www.greenfoot.org/scenarios/10267 I see from the HTML source code an applet tag is used:
<applet code="greenfoot.export.GreenfootScenarioViewer.class"
    width="1418"
   height="1070"
  archive="/applet_attachments/0002/5365/greenfoot2665763967480690856.jar"
  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
  style="margin-left: -264px"
  >
  <param name="codebase_lookup" value="false"></param>
  <param name="storage.standalone" value="true"></param>
  <param name="storage.server" value="www.greenfoot.org"></param>
  <param name="storage.serverPort" value="8888"></param>
  <param name="storage.passcode" value="F06CE426115D410D"></param>
  <param name="storage.scenarioId" value="10267"></param>
  <param name="storage.userId" value="18354"></param>
  <param name="storage.userName" value="RobbieThompson"></param>
  Your browser is ignoring the &lt;APPLET&gt; tag.
</applet>
I also see that there is an option for exporting projects to a Webpage (http://www.greenfoot.org/doc/gamepad_export). Is there any documentation available providing detailed instruction on: - how to prepare the .jar file for display on a webpage, and - how to embed the .jar file in the HTML? All help will be greatly appreciated. Regards Robbie
davmac davmac

2013/12/4

#
Check the official documentation for applets: http://docs.oracle.com/javase/tutorial/deployment/applet/
RobbieThompson RobbieThompson

2013/12/4

#
Thanks Davmac. I shall work through the examples to understand the Java side of things. Is there anything i can research on configuring the Greenfoot side for Website deployment? Regards Robbie
davmac davmac

2013/12/4

#
No problem Robbie, but I'm not sure what you mean by:
Is there anything i can research on configuring the Greenfoot side for Website deployment?
When you export your scenario to a "webpage" (i.e. click the "share" button, then "Webpage" tab) Greenfoot will produce a scenario in applet form (jar file) and a corresponding html file with a suitable applet tag, similar to what you posted above. To deploy these to an actual website you just copy them to some directory on your web host. You can of course modify the html file if you wish.
RobbieThompson RobbieThompson

2013/12/4

#
That is great thanks. I have looked at how games have been deployed on this site (e.g. http://www.greenfoot.org/scenarios/10267) and reverse engineered the .jar files and noticed the MANIFEST.MF files contain a lot of config information and wondered if that needed to be configured by the user as part of the Export procedure. But your explanation resolves all this. Thank you. Regards Robbie
You need to login to post a reply.