Html and button in iframe

Hi all, just a stupid question, if I use an iframe to load an external html page, can i use the javascript button control or it would not work coz the page is not included inside the editor?

There is no direct communication between iframe and other window elements.
iframe is basically window within another window, for proper communication you can use Window Messaging API, but that requires code on both sides.

so there isn’t a way to load and external page and use it inside the project?

If you really need an external page, then you will have to establish communication with its internals using Window Messaging API. It is possible.

I have searched it, you mean postMessage? do you know where i can find something easy to understand?

This explains it well: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

thanks Max, i thought i was just 1 step away of my goal and now i found myself out of the stadium again sigh

Do you need communication between the game and the external page? Because if you don’t then you can just use an iframe and let the user interact with the page in the iframe.

Yes Vaios i need the communication coz the external page access the mysql archive and in the canvas is displayed the action, so i need the character attribute to be exchanged from one to other. Example the resistence when char is wounded. I saw that i could easy communicate from html internal page and the canvas, never thought it would be different using the iframe. That’s my lack of knowledge. I also saw i can’t use the include function of php inside the internal html code. So I guess the only way is the one suggested by Max.

I start to think that make a single player rpg would be a lot more faster and easy lol

Don’t worry it’s normal to go from MMORPG -> RPG -> TETRIS -> JUST GET A BOX IN THE SCREEN :slight_smile: happens to all of us

LoL if i choose to go for a box in a screen i shave my head bald lol

and if i do this?

<script>$("#testLoad").load("http://www.somesite.com/somepage.html");</script>
<div id="testLoad"></div>