ken
ken

Reputation: 75

window.location not working in ie8

Lets say i am at following page on the website:

http://example.com/account/ask

I am trying to redirect to http://example.com/account/send?id=1 on button click. The below statement is working in ie10, firefox and chrome. But it is not working in ie8.

<script language="javascript">window.location="account/send?id=<?=$qid; ?>";</script>

If the browser is ie8 it goes like this:

http://example.com/account/account/send?id=1

How can i fix this? Or is there a better way to do this?

Upvotes: 1

Views: 8667

Answers (4)

Ashwin G
Ashwin G

Reputation: 1570

Try this window.event.returnValue = false; document.location.href = "account/send?id=";

Upvotes: 0

Greg Guida
Greg Guida

Reputation: 7512

window.location="/account/send?id=<?=$qid; ?>";

Upvotes: 3

Gaurav Agrawal
Gaurav Agrawal

Reputation: 4431

<script language="javascript">window.location.href = "account/send?id=<?=$qid; ?>";</script>

make this changes it will works in all browsers...

Upvotes: 1

Pekka
Pekka

Reputation: 449843

Seems to work as designed - actually I'm surprised that the other browsers are doing it differently. Try adding a slash to make it an absolute URL:

<script type="text/javascript">
 window.location="/account/send?id=<?=$qid; ?>";
</script>

Upvotes: 1

Related Questions