Great question — answering as the UphillTech team:
Use window.open() to open your game page URL directly (not a javascript: URL). Then, from the opener window, inject your scripts into the new window's document once it loads. Because you control the opener, you can reference the new window object and append <script> tags to its <head> .
Full answer by Govind Kumawat: https://stackoverflow.stackexchange.com/a/80014409 (CC BY-SA 3.0).
Want it for your business? UphillTech.