From: laredotornado on
Hi,

Curious if there is a javascript solution to this. I have a URL in
the form of

http://www.mydomain.com/user/zzz

which ultimately loads an index page with the contents

<html>
<script type="Text/javascript">
location.replace("login.php");
</script>
</html>

However, this redirects to the URL

http://www.mydomain.com/user/login.php and I want to redirect to the
URL

http://www.mydomain.com/user/zzz/login.php. How would I rewrite my JS
code to force the redirection I'm thinking of? Thanks, - Dave
From: Sean Kinsey on
On Apr 11, 5:15 pm, laredotornado <laredotorn...(a)zipmail.com> wrote:
> Hi,
>
> Curious if there is a javascript solution to this.  I have a URL in
> the form of
>
> http://www.mydomain.com/user/zzz
>
> which ultimately loads an index page with the contents
>
> <html>
> <script type="Text/javascript">
>         location.replace("login.php");
> </script>
> </html>
>
> However, this redirects to the URL
>
> http://www.mydomain.com/user/login.phpand I want to redirect to the
> URL
>
> http://www.mydomain.com/user/zzz/login.php.  How would I rewrite my JS
> code to force the redirection I'm thinking of?  Thanks, - Dave

Take a look at the location object; https://developer.mozilla.org/en/DOM/window.location
Using location.href you can use the following
location.replace(location.href + "/login.php);
From: laredotornado on
On Apr 11, 10:20 am, Sean Kinsey <okin...(a)gmail.com> wrote:
> On Apr 11, 5:15 pm, laredotornado <laredotorn...(a)zipmail.com> wrote:
>
>
>
>
>
> > Hi,
>
> > Curious if there is a javascript solution to this.  I have a URL in
> > the form of
>
> >http://www.mydomain.com/user/zzz
>
> > which ultimately loads an index page with the contents
>
> > <html>
> > <script type="Text/javascript">
> >         location.replace("login.php");
> > </script>
> > </html>
>
> > However, this redirects to the URL
>
> >http://www.mydomain.com/user/login.phpandI want to redirect to the
> > URL
>
> >http://www.mydomain.com/user/zzz/login.php.  How would I rewrite my JS
> > code to force the redirection I'm thinking of?  Thanks, - Dave
>
> Take a look at the location object;https://developer.mozilla.org/en/DOM/window.location
> Using location.href you can use the following
> location.replace(location.href + "/login.php);- Hide quoted text -
>
> - Show quoted text -

Perfect! To be precise, the exact line is ...

location.replace(location.href + "/login.php");

- Dave