That should work I think, you can also try putting your scripts in the ACP at /admin/appearance/customise#custom-js
If there is a specified key in the session, I want any page to be redirected to the page I specified.
For example, If user visit
/topic,it will be redirected to
/register(if session is set.)
I tried to use the hook
filter:middleware.render.If enter the page directly, it works well.But if you change page via ajax(click Home button etc.), it will throw a error : res has been sent.
I also tried the hook
filter:router.page.But I don't know how it works. I search for this hook in Github, But I can't find something useful.
Could you give me any help? I don't know how to solve it exactly.I will appreciate it if you help me.
It is used in a "middleware" style, so it passes in
next. Just call
res.redirect('/route');if you want to redirect. No need to call
nextunless nothing in your script does anything (and you want NodeBB to continue processing).