Skip to content

Commit 8feaee8

Browse files
authored
Fix login redirect cookie to work in iframes
Browsers are adding new default restrictions to cookies when a page is loaded within an iframe. By default they will block all cookies if the parent page and iframe source are on different sites. This means that if a Mendix app is loaded in an externally hosted iframe (e.g. a dashboard page) this cookie will be blocked and the login redirect will not work. By adding the `SameSite=None` and `Secure` (when applicable) options the restriction is lifted and the cookie will not be blocked.
1 parent 4fe981d commit 8feaee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</script>
3030
<script>
3131
if (!document.cookie || !document.cookie.match(/(^|;)originURI=/gi))
32-
document.cookie = "originURI=/login.html";
32+
document.cookie = "originURI=/login.html;SameSite=None" + (window.location.protocol === "https:" ? ";Secure" : "");
3333
</script>
3434
<script src="mxclientsystem/mxui/mxui.js?{{cachebust}}"></script>
3535
</body>

0 commit comments

Comments
 (0)