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

Website accessible from a browser, but not from fetch? #74

Open
patrickinminneapolis opened this issue Jan 4, 2023 · 1 comment
Open

Comments

@patrickinminneapolis
Copy link

I followed the instructions and chrome can hit: http://127.0.01:8080 but I cannot hit it from javascript that created the server.

  start();  // this creates the server which serves up data to chrome ;

// the next line -- I try to see if I can get any data from it -- it always errors : 
        setInterval(() => {
          fetch("http://127.0.0.1:8080")
            .then((response) => {
              console.log("fetch appeared to succeed");
              return response.text(); // not json()
            })
            .then((data) => console.log(data))
            .catch((err) => {
              console.log("there was an error", err);
            });
        }, 10 * 1000);

Is there any way to hit the webserver from the code that creates the webserver? I am trying to make a CORS-PROXY

@patrickinminneapolis
Copy link
Author

I got my fetch working with 127.0.0.1:8080 after I added

webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

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

1 participant