The URL address in IE and chrome is different after JavaScript jumps

Source: Internet
Author: User

Today, someone in the group asked the question:

Problem Description:

Springmvc+hibernate do a project, with Google Browser all normal, with IE but because the return path problem, reported 404, heroes are what situation? When using IE, the path to the address bar will be one or more layers. In JS with Window.location.href jump, with the relative path, Google is in the project name, ie but one more layer.

Answer:

In fact, this is no matter IE and chrome. In fact, including Firefox. This is caused by the browser's resolution of the relative path.

In the project with Window.location to do the jump,

Jump in @ie to start with current path

Jump in the @ff/chrome to start with the root directory

So the best way is to start with the root directory. Like what:

Window.location,href= "Path/image";

Change to: window.location,href= "/web/path/image";

Also note:

1, IE support window.location,href (URL), other browsers do not support. Unified use: Window.location,href= "/web/path/image";

2, the above question also window.open existence.

Related Article

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.