Messagelib

templatewebenginepage.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "templatewebenginepage.h"
8#include <QWebEngineProfile>
9#include <QWebEngineSettings>
10
11using namespace TemplateParser;
12
13TemplateWebEnginePage::TemplateWebEnginePage(QObject *parent)
14 : QWebEnginePage(parent)
15{
16 settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
17 settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
18 settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
19 settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, false);
20 settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
21 settings()->setAttribute(QWebEngineSettings::XSSAuditingEnabled, false);
22 settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
23 settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false);
24 // We need to activate it in qt5.15 otherwise we can't load local css file and co
25 // settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false);
26 settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false);
27 settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, false);
28 settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, false);
29 settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
30 settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
31 settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false);
32 settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
33
34 settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
35 settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, false);
36 settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, false);
37 settings()->setAttribute(QWebEngineSettings::NavigateOnDropEnabled, false);
38 profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
39 profile()->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
40}
41
42TemplateWebEnginePage::~TemplateWebEnginePage() = default;
43
44#include "moc_templatewebenginepage.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.