How to save text to file?

I want to save text value from variable to file.

Let’s suppose that I will send the text to tab[1]… How will I find out the url of the tab[1] page?

Depends on what tab[1] is and what your permissions are.

Can you recomend me some online JS validator which uses Chrome API?

I have opened new tab and empty html page in it.
moz-extension://8c9d6e57-0e7a-4f1a-ae79-1b1a1d53c37f/content_scripts/empty.html

How to grant the permissions to connect content scripts?

Regarding the content scripts permissions I have this in my manifest:

"content_scripts": [
{
"matches": ["*://biblehub.com/*"],
    "js": [
      "jquery-3.0.0.js",
      "content_scripts/addListeners.js",
      "content_scripts/featureA.js",
      "content_scripts/content_script.js"
      ],
    "persistent": false
}
]

Yet I have tried to change it

"content_scripts": [
    {
    "matches": ["<all_urls>" ],
    "run_at": "document_start",
    "js": [
      "jquery-3.0.0.js",
      "content_scripts/addListeners.js",
      "content_scripts/featureA.js",
      "content_scripts/content_script.js"
      ],
    "persistent": false
    }
   ]

But still there are not content scripts connected.

What do you mean by “connected”? Do you not see the scripts being executed? Do they not show any errors? You seem to be jumping from problem to problem in this thread and only barely describing the actual problem.

I do not see them connected in Debugger window, in the Debugger tab. That means, there are no scripts, so they are not executed.

Are you checking in the correct debugger? https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Debugging#Debugging_content_scripts

Note that you will not see the scripts if none of their code is still relevant. So if they execute on load and don’t add any event listeners or similar you will not see them.

Yes this is the debugger for content scripts.

Are you trying to have inline scripts?

  • List item

Note that you can also just load scripts as <script src=""> in extension pages and get full access to all APIs, but I assume you’re using this to test your content scripts.

Thank you, now they are loaded.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script src="addListeners.js"></script>
<script src="featureA.js"></script>
</body>
</html>

Oh, also, <all_urls> does not match moz-extension:// pages: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#<all_urls>

How do you add permissions to those extension scripts when you cannot “match” them?

I’m not sure I follow your question. If you want scripts in your extension page, you include them with <script> tags. If you want scripts in pages that aren’t from you (like websites) you use content scripts.

Ok, now that’s clear.