Bug Tracker

Ticket #6453 (closed bug: invalid)

Opened 5 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

Description

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

Change History

comment:1 Changed 5 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 4 years ago by addyosmani

  • need changed from Patch to Test Case
  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to invalid

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