Skip to content
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

anchor: fix link in FF when served from file system #482

Closed
mnissl opened this issue Feb 20, 2023 · 2 comments
Closed

anchor: fix link in FF when served from file system #482

mnissl opened this issue Feb 20, 2023 · 2 comments
Assignees
Labels
browser This is a topic related to the browser but not the theme bug Something isn't working
Milestone

Comments

@mnissl
Copy link

mnissl commented Feb 20, 2023

In static\js\theme.js, function initAnchorClipboard() creates the link for a heading that can be copied into clipboard.

In line 264, document.location.origin and document.location.pathname are concatenated to build the URL. Alas, origin is null in Firefox which represents a ten year old bug.

But there's an easy workaround available: document.location.href is the result when concatenating the two other properties. So line 264 could simply consist of this:

var url = encodeURI(document.location.href);

@McShelby
Copy link
Owner

I will take a look into it. Sadly it may be not that easy as document.location.href may also contain the fragment specifier which we explicitly don't want to have here.

@McShelby McShelby self-assigned this Feb 20, 2023
@McShelby McShelby added the bug Something isn't working label Feb 20, 2023
@McShelby McShelby added this to the 5.12.0 milestone Feb 20, 2023
@McShelby McShelby changed the title "Add link to clipboard" not working in Firefox when content is served from filesystem anchor: fix link in FF when served from filesystem Feb 20, 2023
@McShelby
Copy link
Owner

Thanks for reporting. This is now fixed

@McShelby McShelby added the browser This is a topic related to the browser but not the theme label Feb 20, 2023
@McShelby McShelby changed the title anchor: fix link in FF when served from filesystem anchor: fix link in FF when served from file-system Feb 24, 2024
@McShelby McShelby changed the title anchor: fix link in FF when served from file-system anchor: fix link in FF when served from file system Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser This is a topic related to the browser but not the theme bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants