Last modified by Alex Cotiuga on 2026/07/27 06:09

From version 18.14
edited by Alex Cotiuga
on 2026/07/09 20:12
Change comment: There is no comment for this version
To version 18.16
edited by Alex Cotiuga
on 2026/07/09 20:28
Change comment: There is no comment for this version

Summary

Details

XWiki.JavaScriptExtension[1]
cache
... ... @@ -1,0 +1,1 @@
1 +long
code
... ... @@ -1,0 +1,31 @@
1 +require(['jquery'], function ($) {
2 + $(function () {
3 + var sourcePageField = $('input[name="sourcePage"]');
4 +
5 + if (!sourcePageField.length || sourcePageField.val()) {
6 + return;
7 + }
8 +
9 + if (!document.referrer) {
10 + return;
11 + }
12 +
13 + try {
14 + var referrerUrl = new URL(document.referrer);
15 +
16 + if (referrerUrl.origin !== window.location.origin) {
17 + return;
18 + }
19 +
20 + var sourcePage = referrerUrl.pathname
21 + .replace(/^\/bin\//, '')
22 + .replace(/\/$/, '');
23 +
24 + if (sourcePage) {
25 + sourcePageField.val(sourcePage);
26 + }
27 + } catch (e) {
28 + // Ignore invalid referrer values.
29 + }
30 + });
31 +});
name
... ... @@ -1,0 +1,1 @@
1 +document referrer catcher
use
... ... @@ -1,0 +1,1 @@
1 +currentPage