Bug Tracker

Opened 15 years ago

Closed 13 years ago

Last modified 11 years ago

#3281 closed bug (duplicate)

double requests in IE when appending script elements

Reported by: arrix Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: Cc: arrix
Blocked by: Blocking:

Description

$(document.body).append($(document.createElement('script')).attr({
  type: 'text/javascript',
  src: 'http://localhost/json.js'
}));

The code above creates a script element, sets attributes and appends it to document using jQuery dom manipulation. In my IE7, two requests are sent to server. It turns out that IE7 sends the request right after you set the src attribute even if the script element is not attached to the document tree yet. Then jquery calls evalScript in append, making another request.

Though this is technically not a jQuery bug, it could cause hard to find bugs.

Change History (5)

comment:1 Changed 15 years ago by arrix

Component: coreajax

comment:2 Changed 14 years ago by dmethvin

Cc: arrix added

Depending on the resolution of #3105 the behavior of this test case may change.

Is there a particular reason for creating/appending a DOM element vs doing it all in a string? Or does it happen for that case as well?

comment:3 Changed 14 years ago by dmethvin

Also, this appears like it may be a duplicate of #2612 which reports that the problem only occurs with an absolute URL.

comment:4 Changed 13 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:5 Changed 13 years ago by dmethvin

Duplicate of #2612.

Note: See TracTickets for help on using tickets.