Securing content on the front end can be tough so we have come up with a few code snippets to add to your Webflow website that will ensure things run smoothly.
If you haven't already, be sure to follow the instructions in this article on gated content.
Make sure javascript is enabled:
Here is a code snippet that redirects a user to the URL provided if the user has javascript disabled. Change https://www.memberstack.com
to the url you want the user to be redirected to. You can view more about this here.
<noscript>
<meta http-equiv="refresh" content="0; url=https://www.memberstack.com" />
</noscript>
Make sure cookies are enabled:
Here is a code snippet to be added to the <head> of your website. Change /please-enable-cookies
to whatever you want your “Please enable cookies"
URL to be.
function checkCookiesAndLocalStorage() {
try {
// Check if cookies are enabled
const cookiesEnabled = navigator.cookieEnabled;
if (cookiesEnabled === false) throw new Error("Cookies Disabled")
window.localStorage.setItem("isEnabledTest", "test")
window.localStorage.removeItem("isEnabledTest")
} catch(err) {
window.location.href = "/please-enable-cookies"
}
}
checkCookiesAndLocalStorage()
Make sure Memberstack isn't being blocked:
Coming soon...
Comments
0 comments
Please sign in to leave a comment.