問(wèn)題描述
我的電子應(yīng)用程序隨機(jī)重定向到 chrome-error://chromewebdata
,我不知道為什么.控制臺(tái)等沒(méi)有錯(cuò)誤.
My electron app is randomly redirecting to chrome-error://chromewebdata
, and I've no idea why. There's no errors in the console, etc.
當(dāng) Electron 應(yīng)用程序第一次啟動(dòng)時(shí),窗口打開(kāi),它從我的應(yīng)用程序重定向到該 URL,我看到一個(gè)空白的空白屏幕.無(wú)需用戶(hù)交互,只需在應(yīng)用啟動(dòng)時(shí)進(jìn)行.
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.
如果我打開(kāi) devtools,我可以看到 window.location.href
包含 chrome-error://chromewebdata
而不是 http://localhost:9080
(Electron 應(yīng)用程序使用 localhost URL 運(yùn)行).
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-app-name
的本地 Electron/Chrome 數(shù)據(jù)文件夾并重新開(kāi)始,但沒(méi)有成功.
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
?
推薦答案
由于某種原因,您的代碼試圖導(dǎo)航到無(wú)效(不存在)的 URL,然后導(dǎo)致 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
.
重申一下:沒(méi)有直接重定向到 chrome-error://chromewebdata
,而是重定向到不存在或無(wú)法訪問(wèn)的 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.
檢查您的代碼是否會(huì)導(dǎo)致此導(dǎo)航(可能是重定向).檢查 DevTools 中的 Network 選項(xiàng)卡非常有用,確保選中Preserve log".這應(yīng)該可以說(shuō)明到底發(fā)生了什么.
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.
這篇關(guān)于為什么 Chrome(在 Electron 內(nèi)部)會(huì)突然重定向到 chrome-error://chromewebdata?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!