Redirect parent window from Retool

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.

1 Like

Hi @DakotaB! We have a utils.openUrl() function that lets you open a link either in a new tab or the same retool tab. If this url change is from a custom html component, you could trigger a Run JS Code type query from the customer component

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.