-
Notifications
You must be signed in to change notification settings - Fork 485
fix: use referrer for toolbar return link when available #1501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -49,9 +49,26 @@ export class Toolbar { | |||||
|
|
||||||
| const $titleSectionEl = br.refs.$BRtoolbar.find('.BRtoolbarSectionTitle'); | ||||||
| if (br.bookUrl && br.options.enableBookTitleLink) { | ||||||
| // Use referrer if available and from same origin, otherwise use bookUrl | ||||||
| // This allows returning to the previous BookServer Explorer App page | ||||||
| let returnUrl = br.bookUrl; | ||||||
| const referrer = document.referrer; | ||||||
|
|
||||||
| if (referrer) { | ||||||
| try { | ||||||
| const referrerUrl = new URL(referrer); | ||||||
| const currentUrl = new URL(window.location.href); | ||||||
| if (referrerUrl.origin === currentUrl.origin) { | ||||||
| returnUrl = referrer; | ||||||
| } | ||||||
|
Comment on lines
51
to
+63
|
||||||
| } catch (e) { | ||||||
|
||||||
| } catch (e) { | |
| } catch { |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace on the blank line just before appending the <a> element, which violates the repo’s no-trailing-spaces ESLint rule and will fail npm run lint. Remove the whitespace (or the blank line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace on the blank line after
const referrer = document.referrer;, which violates the repo’sno-trailing-spacesESLint rule and will failnpm run lint. Remove the whitespace (or the blank line).