document.referrer在角度2中始终为空白 [英] document.referrer is always blank in angular 2

查看:62
本文介绍了document.referrer在角度2中始终为空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试两种情况: 1.可以从外部站点重定向到我站点的页面之一.我试图在重定向后使用document.referrer捕获外部站点名称,但是它为空. [注意-我经过Azure AD身份验证后被重定向.]

I am trying two scenarios: 1. Redirection can take place from an external site to one of the pages of my site. I am trying to capture the external site name using document.referrer after this redirection, but it is empty. [ NOTE- I am redirected after Azure AD authentication.]

  1. 在我的网站内(身份验证后-需要明确).我从一页重定向到另一页.在下一页上,我试图通过document.referrer获取上一页URL.但是在这里,它还是空白.

请提出如何使用角度2打字稿实现从当前页面重定向到当前页面的方法.

Please suggest how to achieve the previous page from where the redirection to current page has occurred using angular 2 typescript.

推荐答案

您可以尝试将引荐来源网址放在state变量中,并在AzureAD重定向回之后读回.

You could try putting the referrer in the state variable and reading back after AzureAD redirects back.

有关状态变量和您可以发送的其他参数的某些信息,请检出

For some info on the state variable and other params you can send, checkout this doc.

这篇关于document.referrer在角度2中始终为空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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