Skip to main content

Bug Tracker

Side navigation

#6453 closed bug (invalid)

Opened April 17, 2010 07:07AM UTC

Closed October 03, 2010 01:29AM UTC

Last modified October 18, 2010 12:21PM UTC

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)

Attachments (0)
Change History (3)

Changed April 18, 2010 03:02AM UTC by dmethvin comment:1

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?

Changed October 03, 2010 01:29AM UTC by addyosmani comment:2

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.

Changed October 18, 2010 12:21PM UTC by anonymous comment:3

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 );