I would appreciate all advice offered regarding this
I would appreciate all advice offered regarding this
Hello John,
The problem is that the app Files Manager are only prepared to include scripts to be available in the app context, not in the background nor the content context of a Web Extension. The "WebExtMessage" app's event is running from the app context, so, certainly it's possible to use the script's stuff there. Please, upgrade your AB copy: I prepare the app Files Manager and the File Picker dialog in order to allow to check scripts to be included "as content script" and / or "as background script", so that scripts are copied and linked in the Web Extension manifest file. I hope this can help you.
Hello John,
That is absolutely fantastic. Thanks for this new feature.
Glad to know that can be useful to you! ;-)
Hello John,
Let me to think about. The objective was to maintain the backward compability, so, by default the "Is Content" and "Is background" checkboxes are unchecked, means the script that we add (or we already add in the past) are used by the app context, and not by the Web Extension context.
What do you want to share between the app context and the Web Extension content context and Web Extension background context? Remember that we are talking about different contexts, so, I am not sure if we can really use the same stuff in all contexts.
In fact, I am not sure if we really can do it... let me to explain. Supose you have a script which is used by the app context. That stuff is linked in the app's HTML, in order to be available in the app context, but, this stuff is not available in the Web Extension context, and cannot be available...
At least cannot be available "as is"... supose you place a global variable in the app's script, then you cannot use that global variable in the Web Extension context... because we are talking about the same script, but, the script is not shared between the different contexts, so possible changes in the variable in one context, are not available in other context.
If what you wanted is to use some JavaScript object definition, in order to be available in all the contexts, then, a possible solution right now can be to duplicate the script, that is, you can prepare two "script1.js" and "script2.js", with the same JavaScript object definition, so you can use the app's File Manager and add the two scripts, one for the app context, and the other for the Web Extension content and / or background context.
Remember the ability to share stuff between the app and the Web Extension contexts using messages: this is the way that we must use in order to communicate some possible variables values, etc. Adding the same script in the app and the Web Extension contexts cannot avoid the requirement to use messages in order to communicate the different contexts that we are talking about.
Please, post here if you have any question or want to comment something about, John.
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.
This website uses some useful cookies to store your preferences.