Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#6453 closed bug (invalid)

Dynamically adding a JS file(s) not caching in Opera

Reported by: GrandMother Owned by:
Priority: undecided Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: $.getScript, head.append, cache, opera Cc:
Blocked by: Blocking:

Description

even if 'cache' option is true. every generation of page - loading from server (viewing apache logs)

Change History (3)

comment:1 Changed 13 years ago by dmethvin

There can be many non-bug reasons that the browser may fetch a script. The server may be returning a don't-cache header for example. Can you post a complete example?

comment:2 Changed 13 years ago by addyosmani

need: PatchTest Case
Priority: undecided
Resolution: invalid
Status: newclosed

Please re-submit your ticket with a valid working example and details regarding what version of Opera you are experiencing this bug with.

comment:3 Changed 12 years ago by anonymous

up up. opera v10.63 win my code:

var s = document.createElement("script");
s.setAttribute("src","sample.js");
s.setAttribute("type","text/javascript");
$('head').append(s);

i found solution. remove next code (line: 5663-5672 in jquery-1.4.3.js)

// Set header so the called script knows that it's an XMLHttpRequest
// Only send the header if it's not a remote XHR
if ( !remote ) {
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}

// Set the Accepts header for the server, depending on the dataType
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
				s.accepts[ s.dataType ] + ", */*; q=0.01" :
				s.accepts._default );
Note: See TracTickets for help on using tickets.