简体   繁体   中英

window.location does not works the same way in IE9 and FF

function showBookings(transactionID) {
    window.location = "txgateway/bookingsSearch.do?ctrl=tabsetTransactionSearch&action=TabClick&param=bookings&transactionId=" + transactionID;
}

in FF is:

http://localhost/name/txgateway/bookingsSearch.do?ctrl=tabsetTransactionSearch&action=TabClick&param=bookings&transactionId=1

and in IE

http://localhost/name/txgateway/txgateway/bookingsSearch.do?ctrl=tabsetTransactionSearch&action=TabClick&param=bookings&transactionId=1

i am calling it from:

http://localhost/name/txgateway/transactionDetails.do?transactionId=1

what to do that lionk will be the same in FF and IE. The right one is in FF.

Either remove the txgateway from the relative path since transactionDetails.do and bookingsSearch.do are in the same directory:

window.location = "bookingsSearch.do?...";

Or use an absolute path starting at the root:

window.location = "/name/txgateway/bookingsSearch.do?...";

Otherwise, with txgateway already a directory in the current window.location , it should appear twice in the resulting URL when it's mentioned again in the relative path.

So, IE is correct in this case. While Firefox apparently recognized the repeat of txgateway and tried to correct it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM