Basically i want to access site http://www.domain.com
what i want to do is that upon logging in, it should directly take me to
http://www.domain.com/access.aspx
But I have very little knowledge of java script, so far i made it but its continuely redirecting in in a loop like
http://www.domain.com/access.aspx/access.aspx/access.aspx/access.aspx/access.aspx/access.aspx
Why is it redirecting again and again, i just want it to redirect it once.
This is my existing code
var loc = window.location.href; var a = loc +"access.aspx"; window.open(a);
I am using a separate script for logging in, and separate for redirecting.
You don't seem to be checking if redirection is required so I suspect that your redirection logic is being applied even when you're already on the page you want to be on. Consider one of the following:
Add an exclude
rule which will cause your script to be not be executed on the access.aspx
page.
@exclude http://www.domain.com/access.aspx
.
Check before you redirect, something like
var loc = window.location.href; if(loc != 'http://www.domain.com/access.aspx'){ var a = loc +"access.aspx"; window.open(a); }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.