I'm using a cookie script at work that appears to be conflicting with react-snap. The script contains proprietary code and I'm not allowed to paste it publicly, is there any way I can discuss this with you on email or some other private means? Thanks.
You can write me to my nickname at gmail dot com. The first question I will ask what you try to do? You should treat react-snap as web crawler, so it should not interact with cookies in any way. You can disable user specific code by sniffing user agent.
I will close this as not actionable
@lewisdonovan We've come across the same problem - what was the solution in your case?
We have a cookie consent warning that pops up and uses localStorage to determine whether to show. With react-snap, the cookie warning shows but the DOM content of the warning is replaced with some other DOM content from the app!
You mean this one https://cookieconsent.insites.com/? You should detect if the client is react-snap, if it is you should not trigger popup.
const isReactSnap = navigator.userAgent === 'ReactSnap';
Full example
<link rel="stylesheet" type="text/css" src="css/cookieconsent.min.css" />
<script src="js/cookieconsent.min.js"></script>
<script>
var isReactSnap = navigator.userAgent === 'ReactSnap';
if (!isReactSnap) {
window.cookieconsent.initialise({
container: document.getElementById("content"),
palette:{
popup: {background: "#fff"},
button: {background: "#aa0000"},
},
revokable:true,
onStatusChange: function(status) {
console.log(this.hasConsented() ?
'enable cookies' : 'disable cookies');
},
law: {
regionalLaw: false,
},
location: true,
});
}
</script>
I was facing the same issue with cookieconsent (the notice would appear but not close) and the example above fixed it.
Confirmed working in lifecycle methods too:
componentWillMount() {
var isReactSnap = navigator.userAgent === 'ReactSnap'
if (!isReactSnap) {
//cookie function here
}
}
Most helpful comment
Full example