I actually think this is a bug/inconsistent behavior/unanticipated use case. I find that I can trigger the “Leave Site” dialog by attempting to load a new URL in my app’s parent window.
For example: parent.window.location.replace("someURL");
(Other similar techniques for URL loading cause the same behavior. The issue seems to be triggered by accessing the parent container.)
This does not happen if one uses “Open an External Website” (which targets the app’s window – not the parent above it).
The reason that I need to redirect the app’s parent window, by the way, is that my app creates embeddable widgets which can be hosted in iFrames. What I’m trying to do is add support for custom redirects in response to certain actions in my app.
For example, in my Booking Widget, some of my users want to be able to redirect the browser after a visitor has submitted a booking inquiry. This would be useful for loading either (a) a customized “thank you” page and/or (b) a page that includes a tracking pixel or tag, etc. so that they can track conversions.
What I find is that at present, one is only able to load a new page inside the iFrame hosting the widget without triggering the “Leave Site” dialog.
I’m looking for workarounds, but I’m going to be describing this behavior in a new post and also submitting a bug report / request for enhancement. It looks to me like one does need some sort of mechanism for forcing the Leave Site dialog to NOT appear and/or intercept it.
This behavior happens whether the current user is logged in or not, BTW.
It also happens even if you disconnect the redirect behavior from any other workflow actions. For example, at the end of the “submit inquiry” workflow, I tried setting a Boolean custom state (“Do Redirect”) to yes. And then I have a “Do when condition is true” that just listens for that state being yes and, in response, triggering a Custom Event workflow that handles the redirect.
@sridharan.s it might be helpful if you also submitted a bug report about this behavior. While it may not be a bug, there are some very valid use cases for being able to defeat the “Leave Site” dialog!
Regards,
Keith