为什么Chrome(在Electron内部)突然重定向到chrome-error:// chromewebdata? [英] Why might Chrome (inside Electron) suddenly redirect to chrome-error://chromewebdata?
问题描述
我的电子应用随机重定向到 chrome-error:// chromewebdata
,我不知道为什么。控制台中没有错误,等等。
My electron app is randomly redirecting to chrome-error://chromewebdata
, and I've no idea why. There's no errors in the console, etc.
当Electron应用程序首次启动时,该窗口将打开,它将重定向到我的应用程序以外的URL,我看到一个空白空白的白色屏幕。
When the Electron app first starts, the window opens, and it redirects away from my application to that URL and I see an empty blank white screen. No user interaction is necessary, it just happens when the app starts.
如果我打开devtools,则可以看到 window.location.href
包含 chrome-error:// chromewebdata
而不是 http:// localhost:9080
(
If I open devtools, I can see that window.location.href
contains chrome-error://chromewebdata
instead of http://localhost:9080
(the Electron app runs using a localhost URL).
我尝试删除〜/ Library / Application Support / my下的本地Electron / Chrome数据文件夹-app-name
并重新开始,但是没有运气。
I tried deleting the local Electron/Chrome data folder at ~/Library/Application Support/my-app-name
and starting over, but no luck.
Chrome(在Electron中)可以决定重定向到 chrome-error:// chromewebdata
?
What are reasons that Chrome (in Electron?) can decide to redirect to chrome-error://chromewebdata
?
推荐答案
由于某种原因,您的代码试图导航到无效(不存在)的URL,然后导致 window.location.href
为 chrome-error:// chromewebdata
。
For some reason, your code is trying to navigate to an invalid (non-existing) URL, which then results in window.location.href
being chrome-error://chromewebdata
.
要重申:没有直接重定向到 chrome-error:// chromewebdata
,但改为不存在或无法访问的URL。
To reiterate: there is no direct redirection to chrome-error://chromewebdata
, but instead to a URL that doesn't exist or is not reachable.
检查您的代码是否导致此导航(可能是重定向)。检查DevTools中的网络选项卡,确保已选中保留日志,这非常有用。这应该可以说明到底发生了什么。
Check if your code causes this navigation (possibly a redirect). It is very useful to inspect the Network tab in DevTools, making sure that "Preserve log" is checked. This should give some indication about what exactly is happening.
这篇关于为什么Chrome(在Electron内部)突然重定向到chrome-error:// chromewebdata?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!