SpringMVC framework uses window. location. href in js to request url. The IE incompatibility problem is solved.

Source: Internet
Author: User

SpringMVC framework uses window. location. href in js to request url. The IE incompatibility problem is solved.

When using the springMVC framework, you sometimes need to use window. location. href in js to request a url, such as the following path:

Window. location. href = 'forecast/download. do'

In Google's browser, the actual Request Path is: Project name/forecast/download. do

There are several layers of folders in the middle during IE access:

 

The reason for this is that various browsers have different processing methods when using window. localtion. href to request relative paths.

IE is redirected from the current path

Google redirects from the root directory.

 

So the best way is to use absolute paths so that they can jump from the root directory:

 

<Script type = text/javascript> function getPath () {var path = <% = path %>; return path ;}</script>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.