Skip to main content

Bug Tracker

Side navigation

#1750 closed enhancement (fixed)

Opened September 28, 2007 01:17PM UTC

Closed December 12, 2007 08:56PM UTC

getScript fails with scheme-less urls

Reported by: mbaierl Owned by:
Priority: major Milestone: 1.2.2
Component: ajax Version: 1.2.1
Keywords: scheme, script, ajax Cc:
Blocked by: Blocking:
Description

Calling

$.getScript("//www.server.com/script.js");

fails with an XMLHTTP Cross-Domain exception. The reason lies in the function ajax, line 2259:

if ( !s.url.indexOf("http") && s.dataType == "script" ) { 

This just checks for http(s) in the beginning, leaving out scheme-less URLs.

The fix is to change this line to be

if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" ) { 

This also covers scheme-less URLs.

There might be other places in jQuery that have the same problem.

Attachments (0)
Change History (3)

Changed October 18, 2007 12:16AM UTC by john comment:1

component: coreajax

Changed December 05, 2007 09:19AM UTC by mbaierl comment:2

This bug is now 2 month old, will anything happen here? This is a sever show-stopper if a page has to work independent of the protocol...

Changed December 12, 2007 08:56PM UTC by davidserduke comment:3

milestone: 1.2.11.2.2
resolution: → fixed
status: newclosed
type: bugenhancement

Fixed in [4123] using the solution the author suggested.