cefpython icon indicating copy to clipboard operation
cefpython copied to clipboard

Example of serving content using http://myapp/ url - allows to bypass file:// protocol restrictions

Open cztomczak opened this issue 7 years ago • 6 comments

Loading content using file:// protocol has many restrictions. Does't integrate well with http content, cookies don't work, local storage is shared across all urls, Origin header (CRSF) doesn't work, CORS issues with files accessing each other (e.g. between directories), etc. Serving content using http://myapp/ url works similarly to serving content using custom scheme handler e.g. myapp:// (although scheme handlers are more configurable, see #50). It doesn't require running a server or running additional processes, it just maps requests. Currently scheme handlers are not implemented. There is available the wxpython-response.py example that can be found in README-examples.md and it shows how to use a Resource Handler along with web requests.

Related issues:

  • Issue #418 ("Expose resource manager API")
  • Issue #50 ("Scheme handler support")

cztomczak avatar Aug 30 '18 05:08 cztomczak

Can I set '--enable-file-cookies' ?

54huige avatar Sep 01 '18 04:09 54huige

@54huige You can try. You can pass switches to cef.Initialize, see API ref. According to https://peter.sh/experiments/chromium-command-line-switches/ the --enable-file-cookies flag is not available anymore. It was removed via CR bug #470482: https://bugs.chromium.org/p/chromium/issues/detail?id=470482 .

cztomczak avatar Sep 01 '18 05:09 cztomczak

TypeError: OnDownloadProgress() got an unexpected keyword argument 'web_request'

I have no idea what a mistake this is ?

54huige avatar Nov 01 '18 11:11 54huige

@54huige Please ask questions on the Forum. See API docs and https://github.com/cztomczak/cefpython/blob/master/docs/Migration-guide.md#v553-handlers-callbacks-and-other-interfaces .

cztomczak avatar Nov 01 '18 11:11 cztomczak

@ 54huige请在论坛上提问。请参阅API文档和https://github.com/cztomczak/cefpython/blob/master/docs/Migration-guide.md#v553-handlers-callbacks-and-other-interfaces。

你好 论坛网址多少?

54huige avatar Nov 01 '18 11:11 54huige

I would like to learn a bit more about this solution.

Let's say that I have a custom ResourceHandler. In the ProcessRequest method the request comes with http://myapp prefix. How to handle it further?

MSusik avatar Dec 04 '22 20:12 MSusik