// Don't allow JavaScript to open windows.
webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
+ // Allow keyboard navigation.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::SpatialNavigationEnabled, true);
+
+ // Enable full screen support.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
+
+ // Require user interaction to play media.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, true);
+
+ // Limit WebRTC to public IP addresses.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, true);
+
// Set the focus on the WebEngine view.
webEngineViewPointer->setFocus();
}
void BrowserView::loadUrlFromLineEdit(QString url) const
{
// Decide if the text is more likely to be a URL or a search.
- if (url.contains(".")) // The text is likely a URL.
+ if (url.startsWith("file://")) // The text is likely a file URL.
+ {
+ // Load the URL.
+ webEngineViewPointer->load(QUrl::fromUserInput(url));
+ }
+ else if (url.contains(".")) // The text is likely a URL.
{
// Check if the URL does not start with a valid protocol.
- if (!url.startsWith("http") && !url.startsWith("file://"))
+ if (!url.startsWith("http"))
{
// Add `https://` to the beginning of the URL.
url = "https://" + url;