- Home /
Load a HTML Page into a frame in a browser
Hi.
I have a web page made up of two frames, Unity project in one frame and html pages in the other. I would like my Unity project to load HTML pages into the second frame. This will stop my Unity project reloading with every page load.
How would I go about this?
Thanks in advance.
Answer by Julien-Lynge · Jan 08, 2012 at 07:31 PM
Richard,
You can make javascript calls from within Unity and use these to load a webpage in the other frame using the HTML DOM. There are plenty of examples of using JS to load a page in a frame, for instance this one. On the Unity side, here's a page explaining both the ExternalCall and ExternalEval (I suggest you check out the script reference for both).
Good luck.
Thanks NOAA_Julien , I ended up doing this. Works well.
function On$$anonymous$$ouseUp () {
var tJSString = "window.open('page2.html','mainFrame')";
Application.ExternalEval(tJSString);
}
"page2.html" is the URL and "mainFrame" is my frame name.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062755im_/https://answers.unity.com/themes/thub/images/avi.jpg)