Coder Social home page Coder Social logo

Comments (8)

nate-parrott avatar nate-parrott commented on June 11, 2024

Hmm... I think the preferred way of dealing with this is to return HTML and then do your network requests in javascript. This has the added benefit of automatically cleaning up the previous query's requests when the query changes. See the weather plugin for an example of this.

from flashlight.

allenhsu avatar allenhsu commented on June 11, 2024

@nate-parrott Yea, that's a good way, but during development, I found many of the APIs disallow cross domain xhr, which returns No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. while trying to fetch in JS. Any solution to this problem except setting up a proxy server?

from flashlight.

nate-parrott avatar nate-parrott commented on June 11, 2024

Hmm... looks like there's an undocumented switch you can flip on the Webview. We're already using loads of undocumented APIs at it is, so this might be doable — although it might introduce security issues.

from flashlight.

nate-parrott avatar nate-parrott commented on June 11, 2024

Running a local proxy server is another alternative, but that'd be a bit of work...

from flashlight.

nate-parrott avatar nate-parrott commented on June 11, 2024

Actually, I might be mistaken here. Do cross-origin restrictions apply to content loaded by the local app into a webview, or is this just a problem for you during development? (in the browser)

from flashlight.

allenhsu avatar allenhsu commented on June 11, 2024

Thanks @nate-parrott , I succeeded running network requests in JS. As you said, there's no cross domain problem in Flashlight, it just failed when I debug in browser. You can close this issue.

BTW, I created a repo listing Chinese plugins for Flashlight (https://github.com/allenhsu/FlashlightPlugins). Do you have any plan to implement kinda subscription channel so that Chinese users can subscribe to a Chinese plugin list.

from flashlight.

nate-parrott avatar nate-parrott commented on June 11, 2024

I'm sure there's some setting in some browser that'll let you turn off
cross-domain protection during debugging.

Re: Chinese plugins:
That's awesome. At the very least, we could add some way to subscribe to
third-party repositories, but there's gotta be a better way. Maybe I'll add
some sort of channel system and then automatically enable the Chinese
channel for users w/ Chinese as their system language.
(Isn't github blocked in mainland China? Would it make sense to host this
stuff on gitcafe or something?)
On Mon, Nov 17, 2014 at 1:13 AM Allen Hsu [email protected] wrote:

Thanks @nate-parrott https://github.com/nate-parrott , I succeeded
running network requests in JS. As you said, there's no cross domain
problem in Flashlight, it just failed when I debug in browser. You can
close this issue.

BTW, I created a repo listing Chinese plugins for Flashlight (
https://github.com/allenhsu/FlashlightPlugins). Do you have any plan to
implement kinda subscription channel so that Chinese users can subscribe to
a Chinese plugin list.


Reply to this email directly or view it on GitHub
#59 (comment)
.

from flashlight.

allenhsu avatar allenhsu commented on June 11, 2024

@nate-parrott aha, github was blocked only for a few days long time ago. It works fine now.

from flashlight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.