mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-01 01:51:14 -03:00
Work around OS X issue with dropped #fragment in launched URLs
The previous hack used to work around an OS X issue/bug where launching a URL with a #fragment appended would drop the fragment by using `osascript` does not seem to work any more. Append the section name as a query string (in addition to, not instead of #section) and then use some basic javascript appended to the user doc HTML template to parse that and jump to the correct section (if the section was dropped). Closes #4480
This commit is contained in:
@@ -1,2 +1,12 @@
|
||||
</body>
|
||||
<script type='text/javascript'>
|
||||
// Some platforms don't handle launching a browser to navigate a page with
|
||||
// a #fragment specified, so we use this workaround combined with a query string.
|
||||
// See https://github.com/fish-shell/fish-shell/issues/4480
|
||||
var params = new URLSearchParams(window.location.search); //?section=foo
|
||||
var section = params.get("section");
|
||||
if (section != null && location.hash == "") {
|
||||
location.hash = "#" + section;
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user