DougM Posted March 20, 2022 Share Posted March 20, 2022 Hi everyone, Once people arrive on my website, I would like them to be redirected to a specific page but only once. This means once they visited that page and go back to the main page, I don't want them to be redirected again. So far I used this code : <script> setTimeout(function(){ window.location.href = 'https://(mywebsite)'; }, 30000); </script> But this means, once they visited the page and go back to the Main, they will be redirected again and again... Any code to add to this? Thanks Link to comment
paul2009 Posted March 20, 2022 Share Posted March 20, 2022 4 hours ago, DougM said: Once people arrive on my website, I would like them to be redirected to a specific page Instead of redirecting users, have you considered showing users a promotional pop-up? About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity and great design ♥.Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. Content: Links in my posts may refer to SF Digital products or may be affiliate links. Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.Improve your online store with our extensions. Link to comment
DougM Posted March 20, 2022 Author Share Posted March 20, 2022 (edited) 3 hours ago, paul2009 said: Instead of redirecting users, have you considered showing users a promotional pop-up? Yes Paul I have tried but for what we need, I can't created a decent pop-up on Squarespace, so I created a Landing page. ( I need not only the email address of the visitor but also their name, phone number and more...) I would like it to appear after 30 seconds tho. Edited March 20, 2022 by DougM Link to comment
creedon Posted March 20, 2022 Share Posted March 20, 2022 To make the code run only once you could use a cookie or localStorage. Instead of a one a done situation you may want to get fancier and have some kind of expiration or other way to reset your flag. DougM 1 Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
DougM Posted March 21, 2022 Author Share Posted March 21, 2022 14 hours ago, creedon said: To make the code run only once you could use a cookie or localStorage. Instead of a one a done situation you may want to get fancier and have some kind of expiration or other way to reset your flag. Yes, using cookie sounds great but unfortunately I am not good enough in coding. Newbie here. Do you suggest any? Thank you creedon Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment