Call external HTML page

Hello, i have seen somewhere how to load an external html page into playcanvas, but i can’t find it anymore…anyone can help?

Found this,

window.open(“http://www.example.com/page.html”);

but it open a new page in the browser, i wanted to make the page open as an entity

What do you mean by open as an Entity?

You can create HTML assets and display attach them to the page.

http://developer.playcanvas.com/en/user-manual/assets/html/

yes, i know i can create html assets, but if i want call a page that is on an external site?

Can you use an iframe in your HTML asset to load an external page?

uhm… i guess it could work…let me give it a try

Yes iframe works fine … tnx a lot!
https://playcanvas.com/editor/scene/391918
can i exchange data with a php page?

That is really weird that you iframe whole page inside of playcanvas app, can’t see real reason for doing so.
Yes you can: use AJAX.

yes max is weird, but it was just a test, also if i have to say that the site is lot more fast inside playcanvas.
I wanted to use some page or just frames or tables if needed.

Not getting AJAX to work. I use this script-structure within my playcanvas-JS:

  • converted to:
autoGenTextSquares.prototype.doautoGenTextSquares = function (screenPosition) {

    var from = this.cameraEntity.getPosition ();

    var to = this.cameraEntity.camera.screenToWorld(screenPosition.x, screenPosition.y, this.cameraEntity.camera.farClip);



    var result = this.app.systems.rigidbody.raycastFirst(from, to);

    if (result) {
        var hitEntity = result.entity; this.firstPosition =hitEntity.getLocalPosition();
        if (hitEntity.name === 'Start_RecDial1'){  
                                          $.ajax({
      type: "GET",
      url: " ... (meta-cloaked) ... /insertChk.php"
    }).done(function( data) {
                                              console.log("req done");
      alert( "Request is done" );
    }); 
                                            }         
});

And within my exported index.html I write the AJAX reference:

.....
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

    <script src="__start__.js"></script>
    <script src="__loading__.js"></script>
		
</body>
</html>

The page reacts with console and alert, but it doesn’t write to my DB (insertChk.php that already works seprately)


I did find a solution.