J
Jeff
I'm very new to javascript and need only a small amount in an asp.net
application I'm working on. I apologize if I'm not using the correct
terminology to describe the problem.
I got the code below to work under most conditions to capture the client's
screen resolution and then redirect to another page (but there likely are
better ways to code this). This needs to work under 3 conditions; A) if the
current top.location.href is similar to www.hhh/ B) if the current
top.location.href is similar to www.hhh/?user=xxx and C) if the current
top.location.href is similar to www.hhh/default.apsx
The code below works for situation A and B, but not C. In other words, I
need to redirect to
www.hhh/Prelim/00bPreliminary.aspx
and not to www.hhh/default.aspxPrelim/00bPreliminary.aspx
(while also passing the screen resolution and username if there is one).
Can someone please show me what I'm missing to get rid of the default.aspx
if it is there, or to write this in a better manner?
<script type = "text/javascript" >
<!--
{
res = "res="+screen.width+"x"+screen.height;
y = top.location.pathname ;
a = location.search;
if (a == ""){
a = "?";
}
top.location.href= y+"Prelim/00bPreliminary.aspx"+a+"&"+res;
}
// -->
</script>
Thanks
Jeff
application I'm working on. I apologize if I'm not using the correct
terminology to describe the problem.
I got the code below to work under most conditions to capture the client's
screen resolution and then redirect to another page (but there likely are
better ways to code this). This needs to work under 3 conditions; A) if the
current top.location.href is similar to www.hhh/ B) if the current
top.location.href is similar to www.hhh/?user=xxx and C) if the current
top.location.href is similar to www.hhh/default.apsx
The code below works for situation A and B, but not C. In other words, I
need to redirect to
www.hhh/Prelim/00bPreliminary.aspx
and not to www.hhh/default.aspxPrelim/00bPreliminary.aspx
(while also passing the screen resolution and username if there is one).
Can someone please show me what I'm missing to get rid of the default.aspx
if it is there, or to write this in a better manner?
<script type = "text/javascript" >
<!--
{
res = "res="+screen.width+"x"+screen.height;
y = top.location.pathname ;
a = location.search;
if (a == ""){
a = "?";
}
top.location.href= y+"Prelim/00bPreliminary.aspx"+a+"&"+res;
}
// -->
</script>
Thanks
Jeff