简体   繁体   English

将链接从Facebook重定向到网站-JavaScript?

[英]redirect link from facebook to website - javascript?

I have articles posted on facebook from my website http://juniorgoldreport.com/ 我从我的网站http://juniorgoldreport.com/在Facebook上发布了文章

the website is made in wordpress, and I've also created a "Welome" landing page where I want most new users to be directed too. 该网站是使用wordpress制作的,我还创建了一个“ Welome”登陆页面,我也希望在这里引导大多数新用户。

I have no idea where I can find information on how to do this, even after countless efforts of googling. 即使经过无数的谷歌搜索工作,我也不知道在哪里可以找到有关如何执行此操作的信息。

To give an exact idea of what I' trying to create... 确切说明我要创建的内容...

Where someone clicks on an article on facebook, it'll take them to the "welcome" sign up page, then have a link on it to the article that they clicked on. 如果有人单击Facebook上的文章,它将带他们到“欢迎”注册页面,然后在其上具有指向他们单击的文章的链接。 The link would change depending on what article they clicked on so they can be redirected properly. 链接会根据他们单击的文章而更改,因此可以正确地重定向它们。

I know I can just hard code it, and create multiple landing pages with different links in relation to the article posted, but this just seems inefficient. 我知道我可以对其进行硬编码,并创建多个具有相对于所发布文章的不同链接的登录页面,但这似乎效率很低。

Does anyone know how to go about doing this? 有人知道该怎么做吗?

this is the landing page http://juniorgoldreport.com/welcome/ 这是登录页面http://juniorgoldreport.com/welcome/

You can try using Javascript, as it would be much easier than creating several webpages. 您可以尝试使用Javascript,因为它比创建多个网页要容易得多。 At the point in your page where you want a link to be placed, put something like 在您要放置链接的页面中,输入以下内容

<p id="mynewredirectlink"><a href="default.link">Hey!</a></p>

And then at the bottom of your code, add some javascript to resemble this: 然后在代码底部,添加一些类似于以下内容的JavaScript:

<script type="text/javascript">
if (document.referrer === "facebooklink.com")//Where did you come from?
    $("#mynewredirectlink").innerHTML = "<a href="theyclickedfromfacebook.link">Hey!</a>"   //Where are you going?

Then include the other sites you need, and close it with 然后包含您需要的其他站点,并使用

</script>

There may be some sites that have varying parts, like an id, so if you need to, you can use (document.referrer.includes("facebook.com")) instead. 可能有些站点包含不同部分,例如ID,因此,如果需要,可以改用(document.referrer.includes(“ facebook.com”))。

You can convert your landing page into a fullscreen modal popup. 您可以将目标页面转换为全屏模式弹出窗口。 So every new visitor will see the popup when the visit the site or any article. 因此,每个新访问者在访问站点或任何文章时都会看到弹出窗口。 They can fill the form / they can close it to see the article. 他们可以填写表格/可以关闭表格以查看文章。 There is already several plugin for modal popup / newsletter popup. 已经有几个用于模式弹出/新闻通讯弹出的插件。 You just need to do a little bit css to make it full screen. 您只需要做一点CSS即可使其全屏显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM