Bug Tracker

Opened 13 years ago

Closed 12 years ago

#1750 closed enhancement (fixed)

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.

Change History (3)

comment:1 Changed 12 years ago by john

Component: coreajax

comment:2 Changed 12 years ago by mbaierl

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...

comment:3 Changed 12 years ago by davidserduke

Milestone: 1.2.11.2.2
Resolution: fixed
Status: newclosed
Type: bugenhancement

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

Note: See TracTickets for help on using tickets.