let wc1 = '?f=1’;
                  
                  
                      let wc2 = '?f=2’;
                  
                  
                      let wc3 = '?f=3’;
                  
                  
                      if (location.search != wc1 && location.search != wc2 && location.search != wc3) {window.location.replace('https://yandex.ru’);}
                  
                  
                  </script>
                  
                  
                
const blackList = ['?f=1', '?f=2', '?f=3']; if (!blackList.includes(location.search)) { window.location.replace('https://yandex.ru'); } ?
Надо сделать красивее или быстрее?
Красивее, потому что f1 - это жиробасные фильтры (и их много в одной переменной).
я там перепутал в if, наоборот !blackList.includes(location.search) // Ну и выходит это скорее наоборот whiteList, но думаю там уже сам разберешься
🙂 это и есть whitelist! Спасибо
Обсуждают сегодня