I'm trying to create a wix page which will redirect all users that link to it to an external URL.
I tried adding the code below as a "html wix app" but it didn't worked.
<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com">
I had a similar use case and solved it using the wix-location module:
import wixLocation from 'wix-location';
$w.onReady(function () {
wixLocation.to("http://www.my-new-url.com");
})
When you insert an HTML "module" into Wix, it is actually inserted into an iframe on the page rather than the page itself.
Fortunately, the iframe is hosted at the same domain, so you don't have to deal with cross-domain issues. Therefore, this code, when inserted into an HTML module on a Wix page, successfully redirects the parent:
<script type="text/javascript">
window.parent.location.href = "http://www.my-new-url.com"
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With