sc - dont open cors in browser

This commit is contained in:
Scott Chow authored and Manatsawin Hanmongkolchai committed 2021-10-10 09:52:09 +07:00
1 parent c7de74d4d9
commit 754dec4aba
1 file changed
+10 -9
+10 -9
View File
@@ -43,16 +43,17 @@ class PageClass(QWebEnginePage):
if not is_main_frame:
return super().acceptNavigationRequest(url, type_, is_main_frame)
if (
type_ != QWebEnginePage.NavigationTypeTyped
and url.authority() != self.url().authority()
):
# The web is only allowed pages on the same origin
# Cross origin pages would open in browser
if url.scheme() in ("http", "https"):
QDesktopServices.openUrl(url)
# This breaks AFK Warden popups
# if (
# type_ != QWebEnginePage.NavigationTypeTyped
# and url.authority() != self.url().authority()
# ):
# # The web is only allowed pages on the same origin
# # Cross origin pages would open in browser
# if url.scheme() in ("http", "https"):
# QDesktopServices.openUrl(url)
return False
# return False
return super().acceptNavigationRequest(url, type_, is_main_frame)