Forum Discussion
Hi Nathan
Thanks, that would work if i were only loading the iframe once, however I need to detect when the page is still in the iframe even after the user navigates around the embedded site using internal links. In that case the referrer is no longer from the iframe.
I guess it's not surprising that freemarker would not have access to the DOM since it operates on the server and has already done its work by the time the window is loaded into the frame.
Thanks anyway
Chris
It's not perfect, but you could always use a cookie to store whether or not the user is browsing within an iframe.
You would set the cookie on the first page the user views (as at that point you can detect that it is in an iframe). Then you can check for that cookie on the other pages.
If you have control of the parent frame, you could actually pass a parameter in the URL to the first community page you load (which will be a bit more robust than checking the referrer).
The disadvantage with this approach is that you can't tell if the user jumps 'out' of the iframe, as the cookie won't change. For example, they might load the community in a separate tab, or just navigate to the community directly.
Related Content
- 4 years ago
- 13 years agoInactive User
- 6 years ago