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?
window.location="/account/send?id=<?=$qid; ?>";
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>
<script language="javascript">window.location.href = "account/send?id=<?=$qid; ?>";</script>
make this changes it will works in all browsers...
Try this window.event.returnValue = false; document.location.href = "account/send?id=";
精彩评论