blob: 57eb618b32b05bdb65d0166d250c9d433928f6a0 [file] [log] [blame]
Adrià Vilanova Martínezb523be92024-05-25 19:14:19 +02001import {getOptions} from '../common/options/optionsUtils.js';
Adrià Vilanova Martínez46773172024-01-10 21:44:22 +01002
3export async function setUpRedirectIfEnabled(options = null) {
4 if (options === null) options = await getOptions(['redirect']);
5
6 if (options.redirect) {
7 setUpRedirect();
8 }
9}
10
11function setUpRedirect() {
12 window.TWPTRedirectHash = window.location.hash;
13 // We're preloading the redirect option so we can redirect faster in
14 // publicThread.js without having to retrieve the options again.
15 window.TWPTShouldRedirect = true;
16}