iiYO Community

Full Version: Embedding in a webpage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I have a webpage I want to embed my WebStory into and a table I want to use to center the WebStory viewer (I suppose you would call it) However I can't get it to display there, instead it displays at the bottom of my page, I am running it from a XAMPP server on my computer if that makes any difference. My knowledge of JavaScript and HTML is on the basic side, I am more looking for a push in the right direction. I'm assuming it has something to do with the HOST argument from what I can gather from the code, but I'm not sure what I would declare as the "host".

Edit:
I think I had the wrong idea about JavaScript before thinking it was basically Java but designed for web pages and can be used exactly the same, please correct me if I'm wrong but JavaScript just creates objects and adds extra functionality that HTML doesn't have.

Guest

JavaScript lives directly in the browser while Java is included as a plugin. The HOST object you see in the code is only for executing the engine as a local application that has access to the filesystem and such, it is not used when you run the engine in a normal browser.

In your webstory XML file, you can specify an attribute "center" on you "stage" element: http://webstoryengine.org/language:elements:stage

Does this work?

Guest

That's how I have it, however it is still displaying at the bottom of the page. I have it as...

< stage width="771px" height="364px" create="yes" center="yes" resize="no" />

...in the XML file and the lines...

< td >
< script src="js/WebStoryEngine.js" >< /script >
< script >
var game = new WSE.Game({ url: "assets/demo/scene.xml", host: typeof HOST === "undefined" ? false : HOST });
game.start();
< /script >
< /td >

...as such in my html file, with the tags appropriate. Also I apologize for my delay in responding I'm currently in classes. Also I don't need the "host: typeof HOST === "undefined" ? false : HOST" bit then, as I saw the code said it was optional, or is it good to have it there just to keep things clean?

Edit:
Would it be easier if I used a IFrame, or would that not work?

Guest

So I found the solution! I put the code in a IFrame, I had done this originally but the attribute sandbox="allow-scripts" had prevented it from loading properly. Thank you for your assistance and the wonderful program, I was originally going to make a visual novel program myself from scratch in Java but then happened upon this gem. Again thank you and have a wonderful project.