I need to set up a cookie only if the site is on an iframe, however for some reason I can’t make it happen.
<script type="text/javascript">
if (self.location.href!=top.location.href) {
document.cookie = "oniframe=yes;max-age=" + 60 * 60 * 24 * 30;
}
</script>
While browsing the site on an iframe (on other site) I can’t find the cookie.
Any help will be appreciated.
Thanks Daniel
To detect if your site is being loaded in an iframe, you can compare the
selfandtopobjects directly, e.g: