How Can I Apply Javascript Code To Change Elements Of An Iframe?

The Current Code Is Here Glitch
I basically want to make it so the game window covers the entire screen.
I asked on reddit and they sent the javascript code in script.js, but I need it to apply to the iframe.
If there are any other ways to make the game window cover the entire screen please let me know :slight_smile:

Hi,
Welcome to the forum. What exactly are you trying to do? The title and your issue contradict each other. If you want to make the iFrame full screen use width: 100%; height: 100% in your CSS for iframe.

no not the iframe I want fullscreen, the specific element of the game window to be fullscreen

That’s a cross origin iframe, where the outer page and inner page come from different websites. But there are limits to what one site can do to another site.

And that’s a good thing, by the way; it’s the reason I can sign in to my bank’s website while leaving twitter open without them draining my accounts or something.

Arbitrarily changing the HTML and CSS of a page from another site is one of those things that’s off limits. But here are some ideas that don’t involve doing that:

  • use css transforms to scale up the iframe so much that the element in question takes up the whole screen, without really having to change their page
  • write a browser extension instead, which you can give permission to alter pages on other sites
1 Like