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

Configure the Hyperlinks to New Window as default #3949

Closed
2 tasks done
adriangalbincea opened this issue Jan 6, 2023 · 3 comments
Closed
2 tasks done

Configure the Hyperlinks to New Window as default #3949

adriangalbincea opened this issue Jan 6, 2023 · 3 comments

Comments

@adriangalbincea
Copy link

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hi, is there a way to change the default hyperlink window to New Window instead of Current Window?

Exact BookStack Version

v22.10.2

Log Content

No response

PHP Version

No response

Hosting Environment

Docker

@ssddanbrown
Copy link
Member

Hi @adriangalbincea,
There is no in-built option for this but it can be achieved via adding the following code in the "Custom HTML Head Content" customization setting:

<script>
	document.addEventListener('DOMContentLoaded', function() {
		var links = document.querySelectorAll('.page-content a');
		for (var i = 0; i < links.length; i++) {
			links[i].target = '_blank';
		}
	});
</script>

This custom hack is not officially supported but it should be quite stable and rarely ever break.

@adriangalbincea
Copy link
Author

Many thanks @ssddanbrown
I shall give it a try.

@adriangalbincea
Copy link
Author

It works. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants