Skip to main content

Bug Tracker

Side navigation

#6034 closed bug (invalid)

Opened February 04, 2010 10:03PM UTC

Closed February 05, 2010 07:56PM UTC

Last modified February 05, 2010 08:43PM UTC

getScript doesn't always respect the base tag

Reported by: bhasden Owned by:
Priority: major Milestone: 1.4.2
Component: ajax Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:

I've got a website with the <base> tag defined as the website root directory, for example:

In IE8 when I use $.getScript('path/to/script.js') jQuery appropriately requests and loads no matter where the current page is located in the website.

On the other hand, in FF 3.5.7 the request for 'path/to/script.js' is relative to the current page. For example if I'm viewing the getScript call will request

I understand this may not be a bug with jQuery but since jQuery usualy insulates me from these sort of issues it would be nice if jQuery found a way of forcing getScript to behave one way or the other.

Attachments (1)
  • getScript_bug.html (0.3 KB) - added by bhasden February 05, 2010 08:36PM UTC.

    This html file demonstrates the issue. No matter where the file is located in the website it should always request http://localhost/path/to/script.js. The bad behavior comes in when the file is located in a directory underneath the root. IE8 will continue to request the appropriate file while FF3.5 disregards the base tag and requests the script relative to the page url.

Change History (2)

Changed February 05, 2010 07:56PM UTC by john comment:1

component: unfilledajax
resolution: → invalid
status: newclosed

Do you have a simple test page that we can look at? We're just using the native XMLHttpRequest here so figuring out the difference would be ideal.

Changed February 05, 2010 08:43PM UTC by bhasden comment:2

Is there any way jQuery could be updated to pull the base tag href before making the XHR so that it could pull together the absolute url if a base tag exists? I know this isn't the most pressing issue in the world but it's really annoying that the behavior is different between the two major browsers, especially since jQuery is designed to provide consistent cross-browser behavior.