English 中文(简体)
Injection order in Opera extensions
原标题:

Suppose I have an extension that has 3 files in includes directory:

includes/all.js
includes/one.js
includes/two.js

two.js depends on one.js and both of them have guard comments :

// ==UserScript==
// @include http://*.example.com/*
// @include https://*.example.com/*
// ==/UserScript==

all.js loads for every page.

My question is: in what order those .js files will be processed by Opera on http://foobar.example.com/ page?

There are some rumors that the order is alphabetical, but I cannot find a definitive source of this claim.

最佳回答

When we first shipped user javascript support, I noticed that some users started developing libraries and wanted to control the load / execution order. Some of them assumed the order would be alphabetical (at the time it was random, perhaps by file creation time or some such) and would prefix their library file names with A- to make them run first. So I told the developer "let s just implement what people expect and run the scripts in alphabetical order".

It s probably my fault that this is neither documented nor tested..

问题回答

There are some rumors that the order is alphabetical, but I cannot find a definitive source of this claim.

Could not find any confirmation in the documentation, but my experiments showed that content scripts are really loaded in alphabetical order.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签