单击链接时将访问者重定向到登录或注册



我有以下代码,如果用户单击附件,则会重定向用户进行注册。

我还想让用户重定向,如果他们点击以下任何链接....https://storage.ning.com/topology/rest/1.0/file/get/....

如何更改现有代码?

$('.attachments li a').click(function () { 
  if ($('#xn_signout').html() != "Sign Out" || $('#xn_signout').html() == null) {
    $(window.location).attr('href', 'https://community.eflclassroom.com/main/authorization/signUp');
    return false;
  }
});

也许这段代码会有所帮助...它将覆盖页面上的所有锚标签,并自动将页面重定向到您提到的URL。

$(a).on('click',(e)=>{
  e.preventDefault();
  location.href="https://storage.ning.com/topology/rest/1.0/file/get/';
})

最新更新