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? Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? 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 the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. 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