Skip to content

Commit 1d54029

Browse files
committed
pat inject: Allow configurable error pages. Can be disabled by adding pat-inject-errorhandler.off to the URL's query string.
1 parent b017445 commit 1d54029

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
- pat tabs: Refactor based on ``ResizeObserver`` and fix problems calculating the with with transitions.
5555
- pat tabs: When clicking on the ``extra-tabs`` element, toggle between ``open`` and ``closed`` classes to allow opening/closing an extra-tabs menu via CSS.
5656
- pat autofocus: Do not autofocus in iframes. Fixes: #761.
57-
- pat inject: Allow configurable error pages.
57+
- pat inject: Allow configurable error pages. Can be disabled by adding ``pat-inject-errorhandler.off`` to the URL's query string.
5858

5959
### Technical
6060

src/pat/inject/documentation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ The code looks for a meta tag with the name ``pat-inject-`` plus the HTTP status
335335

336336
Another example: You can present the user with a login page in case the session has expired (``401`` error).
337337

338+
You can disable this behavior for debugging by adding the following parameter to the query string:
339+
``pat-inject-errorhandler.off``.
340+
338341
### Options reference
339342

340343
You can customise the behaviour of injection through options in the `data-pat-inject` attribute.

src/pat/inject/inject.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,15 @@ const inject = {
677677
"It seems, the server is down. Please make a screenshot and contact support. Thank you!";
678678
}
679679

680+
const url_params = new URLSearchParams(window.location.search);
681+
680682
const fallback_url = document
681683
.querySelector(`meta[name=pat-inject-${status}]`)
682684
.getAttribute("content", false);
683-
if (fallback_url) {
685+
if (
686+
fallback_url &&
687+
url_params.get("pat-inject-errorhandler.off") === null
688+
) {
684689
try {
685690
const fallback_response = await fetch(fallback_url, {
686691
method: "GET",

0 commit comments

Comments
 (0)