diff --git a/static/skin/viewer.js b/static/skin/viewer.js index 10e8b48d9..50d91ea6c 100644 --- a/static/skin/viewer.js +++ b/static/skin/viewer.js @@ -43,17 +43,17 @@ function gotoMainPageOfCurrentBook() { } function gotoUrl(url) { - contentIframe.src = url; + contentIframe.src = root + url; } function gotoRandomPage() { - gotoUrl(`${root}/random?content=${currentBook}`); + gotoUrl(`/random?content=${currentBook}`); } function performSearch() { const searchbox = document.getElementById('kiwixsearchbox'); const q = encodeURIComponent(searchbox.value); - gotoUrl(`${root}/search?books.name=${currentBook}&pattern=${q}`); + gotoUrl(`/search?books.name=${currentBook}&pattern=${q}`); } function suggestionsApiURL() @@ -338,9 +338,9 @@ function setupSuggestions() { element: (item, data) => { let searchLink; if (data.value.kind == "path") { - searchLink = `${root}/${currentBook}/${htmlDecode(data.value.path)}`; + searchLink = `/${currentBook}/${htmlDecode(data.value.path)}`; } else { - searchLink = `${root}/search?content=${encodeURIComponent(currentBook)}&pattern=${encodeURIComponent(htmlDecode(data.value.value))}`; + searchLink = `/search?content=${encodeURIComponent(currentBook)}&pattern=${encodeURIComponent(htmlDecode(data.value.value))}`; } const jsAction = `gotoUrl('${searchLink}')`; // Values of the href attribute are assumed by the browser to be diff --git a/test/server.cpp b/test/server.cpp index 2c6156c23..c757be4b6 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -69,7 +69,7 @@ const ResourceCollection resources200Compressible{ { DYNAMIC_CONTENT, "/ROOT/skin/taskbar.css" }, { STATIC_CONTENT, "/ROOT/skin/taskbar.css?cacheid=216d6b5d" }, { DYNAMIC_CONTENT, "/ROOT/skin/viewer.js" }, - { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=0933a233" }, + { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=fa85ec82" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf" }, { STATIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf?cacheid=af705837" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Roboto.ttf" }, @@ -291,7 +291,7 @@ R"EXPECTEDRESULT( - + const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";