将wix网站页面重定向到外部URL

时间:2015-06-07 20:16:23

标签: html

我正在尝试创建一个wix页面,该页面会将链接到它的所有用户重定向到外部URL。

我尝试将下面的代码添加为“html wix app”,但它没有用。

<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com">

5 个答案:

答案 0 :(得分:7)

我有一个类似的用例并使用wix-location模块解决了它:

import wixLocation from 'wix-location'; 

$w.onReady(function () {
     wixLocation.to("http://www.my-new-url.com");
}) 

答案 1 :(得分:2)

当您将HTML“模块”插入Wix时,它实际上是插入页面上的iframe而不是页面本身。

幸运的是,iframe托管在同一个域中,因此您不必处理跨域问题。因此,此代码在插入Wix页面上的HTML模块时,成功重定向父代:

<script type="text/javascript">
    window.parent.location.href = "http://www.my-new-url.com"
</script>

答案 2 :(得分:0)

也许试试:

<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com/" />

你遗漏了一个&#34;在末尾。 我希望这有帮助!

尝试:

<script type="text/javascript">
    window.location.href = "http://www.my-new-url.com"
</script>

试试这个:

<html>
<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com/" />
</html>

答案 3 :(得分:0)

您可以使用wix-location中的Wix Code。使用它导航到外部URL的一个示例是:

import wixLocation from 'wix-location';

// ...

wixLocation.to("http://www.my-new-url.com");

答案 4 :(得分:-1)

以上代码:

<script type="text/javascript">
    window.parent.location.href = "http://www.my-new-url.com"
</script>

在我的wix网站上运行: https://www.lemon-sin.com.au/ 重定向到导演的linkedin帐户

相关问题