Bug Tracker

Ticket #1750 (closed enhancement: fixed)

Opened 1 year ago

Last modified 9 months ago

getScript fails with scheme-less urls

Reported by: mbaierl Assigned to: anonymous
Type: enhancement Priority: major
Milestone: 1.2.2 Component: ajax
Version: 1.2.1 Keywords: scheme, script, ajax
Cc: Needs: Review

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

Change History

Changed 11 months ago by john

  • owner deleted
  • component changed from core to ajax

Changed 9 months 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...

Changed 9 months ago by davidserduke

  • status changed from new to closed
  • type changed from bug to enhancement
  • resolution set to fixed
  • milestone changed from 1.2.1 to 1.2.2

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

Note: See TracTickets for help on using tickets.