I need to redirect the parent window based on a custom html form submission from within Retool. Retool is hosted in an iframe on my webpage.
Trying to use window.top.location.href = "http://example.com"; causes the following error: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to 'http://example.com'.".
This is a pretty critical use case here and would love some ideas.
Hey @alex-w. Thanks for the response, I do know about the utility. The issue is that when Retool is iframed, it just changes the window location of the iframe rather than the parent window. Normally I could use something like window.top.location.href = "http://www.example.com";
to redirect the parent window but that does not appear to work with retool.
Hey @alex-w I am trying to use utils.openUrl() to redirect to my iOS app but I am getting the same as @DakotaB then when I try from a desktop, then from my mobile phone, I get that the URL I am redirecting to is un-safe. Is there a workaround? I know that using the built-in re-direct on a button click says that Retool only accepts certain protocols… is there a way around this?
You can use postMessage and have a script in your parent app that adds an event handler that redirects to the URL sent from Retool. A barebones example of this is the following: