从电子邮件框中单击时的document.referrer值 [英] document.referrer value when clicked from email box

查看:76
本文介绍了从电子邮件框中单击时的document.referrer值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

document.referrer 返回链接到该页面的页面的URI.如果用户直接导航到页面(不是通过链接,而是例如通过书签),则该值为空字符串.

document.referrer Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark),

https://developer.mozilla.org/zh-CN/docs/Web/API/Document/referrer 状态.

我的问题是:

当我们从浏览器中单击电子邮件帐户中的链接时,我们会进入document.referrer为空的页面.

When we click on the link within an email account from the browser, we land on the page where document.referrer is empty.

至少对我测试过的几家电子邮件提供商有效,当它们单击我收到的已订阅新闻邮件中的广告/URL时.

At least it's valid for several email providers I've tested when clicked on ads/URLs within subscribed newsletter emails I receive.

对于任何电子邮件提供商而言,这是对的还是不对的?

Will it be true for any email provider or not true?

当从客户的电子邮件中单击链接时,我需要过滤(虽然没有确切的条件)访问者.

I need to filter (no the exact criteria though) visitors when link was clicked from customer's email.

换句话说,如果document.referrer不为空,这是否意味着客户肯定不是通过电子邮件链接(不是来自Yahoo,不是来自Google等)访问我的网站?

With another words, if document.referrer is NOT empty, does this mean the customer definitely came to my web site NOT from email link (not from Yahoo, not from Google etc)?

推荐答案

很容易伪造 document.referrer 值来欺骗另一个站点,但是当出现以下情况时,您不能为其提供值来自电子邮件链接,因为它没有被浏览器中的另一个网页加载.

It's easy enough to fake the document.referrer value to spoof another site, but you can't supply it with a value when coming from an email link, since it's not being loaded by another web page in the browser.

编辑:单击电子邮件链接时,可以模拟 document.referrer 值-您会将用户转到另一个网页,提供引荐来源网址的值,然后将其传递到目标页面-但是出于您的目的,这种情况不太可能.

It would be possible to simulate a document.referrer value when an email link is clicked -- you would send the user to another web page, which would supply the referrer value, then pass them along to the destination page -- but for your purposes, that's not a likely situation.

简短答案: :如果已设置值,除非有人试图欺骗它,否则它不是来自电子邮件链接.

Short answer: If it has a value set, unless someone is trying to spoof it, it didn't come from an email link.

这篇关于从电子邮件框中单击时的document.referrer值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆