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

WebContents.loadUrl() without cache #1360

Closed
maxkueng opened this issue Apr 6, 2015 · 10 comments
Closed

WebContents.loadUrl() without cache #1360

maxkueng opened this issue Apr 6, 2015 · 10 comments

Comments

@maxkueng
Copy link

maxkueng commented Apr 6, 2015

Currently there is no option to load content in to a BrowserWindow without loading from the cache. I don't want to disable caching entirely through the --disable-http-cache switch as I want to use caching during app use. But I want fresh content to load when starting the app.

My current workaround is to load the content using loadUrl() and then use reloadIgnoringCache() to load the un-cached content as soon as it has finished loading. But it feels hacky and the window flickers.

Is there a way to not read from the cache initially but still enable caching? Or could it be added by adding a second argument to loadUrl() like loadUrl('http://github.com', ignoreCache), or maybe add a function like loadIgnoringCache(url)?

@zcbenz
Copy link
Member

zcbenz commented Apr 7, 2015

Chromium didn't expose an API to ignore cache when loading URL, so it is not easy to achieve that.

@maxkueng
Copy link
Author

maxkueng commented Apr 7, 2015

Thanks for looking in to it! Can we leave this open in case Chromuim ever implements such an API?

@deepak1556
Copy link
Member

webContents.loadURL(url, {"extraHeaders" : "pragma: no-cache\n"}) should work.

@etiktin
Copy link
Contributor

etiktin commented Nov 13, 2015

@deepak1556 awesome find! I think we should add it to the docs

@deepak1556
Copy link
Member

@etiktin have added it to the docs here #3432

@enlight
Copy link
Contributor

enlight commented Jul 28, 2017

Closing since this was fixed by #3432

@enlight enlight closed this as completed Jul 28, 2017
@wasimxe
Copy link

wasimxe commented Nov 13, 2018

I added @wv.loadURL(@wv.src, {"extraHeaders" : "pragma: no-cache\n"}) but it is not updating js files included in html , any idea?

@wasimxe
Copy link

wasimxe commented Nov 13, 2018

I tried every combination of extraHeader, cache-control:no-cache,no-store etc and expires set to 0 or past time, nothing is working.

@nuthinking
Copy link

Recently I had some issues too.

@anthonywebb
Copy link

Cached iframe is making it very difficult to develop. Wish I could load fresh.

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

Successfully merging a pull request may close this issue.

8 participants