允许 URL 进入网站吗?
我需要在页面加载之前允许访问几个 URL,其余 URL 将被重定向。
expample: If user trying to access these urls they will be allowed and
other urls will be redirected to google.com (example)
http://mysite.com/site/Dept/IT
http://mysite.com/site/Dept/IT/ITWS
http://mysite.com/site/dept/ce
http://mysite.com/site/dept/mkt
http://mysite.com/site/teams/dgt
http://mysite.com/site/teams/mm
在 jQuery 中如何做到这一点?为 URL 创建 arraylist 并检查 arraylist 并允许它们。
I have couple of URLs that I need to allow to access before page load and remaining URLs will be redirected.
expample: If user trying to access these urls they will be allowed and
other urls will be redirected to google.com (example)
http://mysite.com/site/Dept/IT
http://mysite.com/site/Dept/IT/ITWS
http://mysite.com/site/dept/ce
http://mysite.com/site/dept/mkt
http://mysite.com/site/teams/dgt
http://mysite.com/site/teams/mm
How can do this in jQuery? Making arraylist for URL and check against arraylist and allow them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在每个页面上加载 Javascript 片段,如果当前页面的 url 与其中任何一个都不匹配,它将重定向用户。
You can load Javascript snippet on every page and it will redirect the user if the current page's url doesn't match any of these.
将此用于外部 URL。
如果您确实想拒绝服务器上的特殊 URL,我强烈建议您这样做它在服务器端。
Use this for external URL's.
If you realy want to reject special URL's on your server I would realy suggest you to do it serverside.