Help with "location.replace"

L

laredotornado

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
 
S

Sean Kinsey

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top