Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript script is not modifying the DOM #1174

Open
Saya47 opened this issue Jan 22, 2023 · 2 comments
Open

Javascript script is not modifying the DOM #1174

Saya47 opened this issue Jan 22, 2023 · 2 comments

Comments

@Saya47
Copy link

Saya47 commented Jan 22, 2023

Hello I hope you're all doing well!

I'm using --disable-private-mode argument of the Docker image and the default LUA script.

I've made a single page website using Django and the HTML loads a script on head:

<script src="/static/js/modify-the-dom.js"></script>

And all the script does is to write something on the page:

window.onload = function(){
    document.write('Modified the DOM!');
}

This change shows up on the browsers! But on on Splash.

So I was wondering how to fix that. I tried adding bigger wait as well to no avail.
I also checked my Splash with this website and it seems JS is not enabled!
https://www.whatismybrowser.com/detect/is-javascript-enabled
How should I enable it?

I also tried another single page app using React and all it does is add an element to root:

function F(){
  class HelloMessage extends React.Component {
    render() {
      return React.createElement(
        "div",
        null,
        "Hello ",
        this.props.name
      );
    }
  }
  return(React.createElement(HelloMessage, { name: "Taylor" }));
}

But Splash only shows a blank white page!

Thanks a lot!

@GerritGeeraerts
Copy link

I also have the same issue where on several sites the java-script is not executing. I also started the docker with --disabled-private-mode
Screenshot from 2024-02-15 16-48-14
I like your test, that isolates the problem well:

window.onload = function(){
    document.write('Modified the DOM!');
}

There most be something really basic going wrong.
Help would be appreciated!

@Saya47
Copy link
Author

Saya47 commented Feb 15, 2024

@GerritGeeraerts I never figured this out, I moved to using Puppeteer actually. Much better results than libraries currently available on Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants