DOM Element not processing script from page

When I initially set up my scene with the DOM element it would process the script running on the page. However, now it no longer is processing the scripts on any page loaded. I’ve tried working from the ground up again to see where the issue starts, but it still would not acknowledge any scripts from the page loaded.

Update: After testing and playing around with my project some more, I now realize that the scripts on the page being loaded using DOM were never truly running initially as I thought they were. Therefore, I suppose the question I have is if it is possible to run the scripts on the page being loaded.

For example, I created a test.php page with:

I then have my .js scene file in which I load the page in preload:
this.load.html(‘testPage’, ‘test.php’);

Then, in create, I have the following code:
var element = this.add.dom(config.width/2, config.height/2).createFromCache(‘testPage’);

It will load the page. But the script will not run. The script for each page I test works when simply loaded outside the game, however something about loading it through my game is causing the script not to run. Is it possible to have the script run, and if so, how would I go about doing so?

https://photonstorm.github.io/phaser3-docs/Phaser.Loader.LoaderPlugin.html#html

It doesn’t look like Phaser supports php files. Do you just want to execute a php script? You can do that by making an invisible iframe, and setting the location of it to the php script when you want to execute it. I would google this, as I haven’t done that in a while.

The problem actually occurs whether or not the page in question is html or php. It’s the script tags on the pages (whether html or php) that are not running. I wanted to know if that is by design or if there is a way that I can use them. The php script actually works and I’ve been able to work with it on my pages as needed.

From my understanding of Phaser DOM, when you load an html file you aren’t actually loading an entire page (doctype etc.). What I mean is that my DOM usage’s html would look like this:

<div>
<input type="checkbox">
<label>On/Off</label>
</div>

Anyway, I just tested out trying some very basic javascript and it doesn’t run, so that explains your issue. I would just use pure javascript (w/o phaser) to run it.

Okay, I understand what you’re saying. I initially thought that was the reason, but was confused due to the fact that I’m able to still run the php code. Do you by any chance know why I’m able to do that? When this problem initially surfaced, I created a makeshift solution by using the scene’s update function to check for any changes on an element’s value and using the php to change that value. I’ve been able to also complete additional scenes in the meantime using creative solutions, but I just wanted to know if there was a better approach before getting to a more complicated scene. I’ll probably just continue using DOM and working around it, and also see if your iframe solution is more feasible.