Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect a wix website page to external URL

Tags:

html

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">
like image 649
ASM Avatar asked Jun 07 '15 20:06

ASM


2 Answers

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");
}) 
like image 181
Anke Avatar answered Oct 10 '22 03:10

Anke


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>
like image 27
Stephen Saucier Avatar answered Oct 10 '22 04:10

Stephen Saucier