Skip to content

Commit

Permalink
fix: should not call failed load event when is not main frame
Browse files Browse the repository at this point in the history
  • Loading branch information
KochiyaOcean committed Jan 4, 2024
1 parent 9821be6 commit 303beb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion views/components/etc/webview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const ElectronWebView = forwardRef<ExtendedWebviewTag | undefined, Props>(
// Error handling
useEffect(() => {
const callback = (e: DidFailLoadEvent) => {
if (e.errorCode !== -3) {
if (e.errorCode !== -3 && e.isMainFrame) {
const errorScript = `document.write('<br>Webview load error<br>Error Code: ${e.errorCode}<br>Description: ${e.errorDescription}<br>URL: ${e.validatedURL}')\ndocument.body.style.backgroundColor = "white"`
const target = e.target as WebviewTag
target.executeJavaScript(errorScript)
Expand Down

0 comments on commit 303beb7

Please sign in to comment.