I'm working on Drupal 8.9.6.

I'm trying to redirect users to a particular page after they add a node. I can do that without any problem, by adding the following information in the form's URL:


However, when I try to have a specific tab of the destination page opened, as follows:


It directly redirects me to /author-list, ignoring the #tab2 part. While if I enter in the browser /author-list#tab2 I get the /author-list page with the #tab2 active without problem.

Does anyone know what could be happening?

Thank you!

1 Answer 1


Most if not all browsers strip the hash (fragment) and this information is lost so you can't rely on hash being in the URL.

RFC 3986 states:

the fragment identifier is not used in the scheme-specific processing of a URI; instead, the fragment identifier is separated from the rest of the URI prior to a dereference, and thus the identifying information within the fragment itself is dereferenced solely by the user agent, regardless of the URI scheme. Although this separate handling is often perceived to be a loss of information, particularly for accurate redirection of references as resources move over time, it also serves to prevent information providers from denying reference authors the right to refer to information within a resource selectively.

Possible workaround: Create a hidden input field url_fragment and make sure it passes as a URL parameter (&url_fragment=hashvalue). Have some javascript execute on load of this page and if it finds the url_fragment in the URL make it do a scrollTop and opening of the specific tab.

Here is a question and answer that does the scrollTop if the urlParemeter EXISTS. You need to modify this script to get the actual value and also click the Tab.

  • Thank you, that did the trick. Just take into consideration that you cannot use to pass the parameter '?' and '=', but the url-encode value for those characters: stackoverflow.com/questions/11940414/…
    – GJW80
    Commented Nov 6, 2020 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.