diff --git a/kiwix-desktop.pro b/kiwix-desktop.pro
index cf37176..1c6ea24 100644
--- a/kiwix-desktop.pro
+++ b/kiwix-desktop.pro
@@ -232,6 +232,7 @@ RESOURCES += \
resources/translations.qrc \
resources/contentmanager.qrc \
resources/settingsmanager.qrc \
- resources/style.qrc
+ resources/style.qrc \
+ resources/js.qrc
RC_ICONS = resources/icons/kiwix/app_icon.ico
diff --git a/resources/js.qrc b/resources/js.qrc
new file mode 100644
index 0000000..8391239
--- /dev/null
+++ b/resources/js.qrc
@@ -0,0 +1,5 @@
+
+
+ js/headerAnchor.js
+
+
diff --git a/resources/js/headerAnchor.js b/resources/js/headerAnchor.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/kprofile.cpp b/src/kprofile.cpp
index 6659ebb..cefe6f7 100644
--- a/src/kprofile.cpp
+++ b/src/kprofile.cpp
@@ -4,6 +4,26 @@
#include
#include
#include
+#include
+#include
+
+namespace
+{
+
+QWebEngineScript getScript(QString filename,
+ QWebEngineScript::InjectionPoint point = QWebEngineScript::DocumentReady)
+{
+ QWebEngineScript script;
+ script.setInjectionPoint(point);
+ script.setWorldId(QWebEngineScript::UserWorld);
+
+ QFile scriptFile(filename);
+ scriptFile.open(QIODevice::ReadOnly);
+ script.setSourceCode(scriptFile.readAll());
+ return script;
+}
+
+}
QString askForSaveFilePath(const QString& suggestedName)
{
@@ -36,6 +56,8 @@ KProfile::KProfile(QObject *parent) :
#else // Qt 5.13 and later
setUrlRequestInterceptor(new ExternalReqInterceptor(this));
#endif
+
+ scripts()->insert(getScript(":/js/headerAnchor.js"));
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)