最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

xcode - Safari web extension - Stack Overflow

programmeradmin2浏览0评论

When testing a Safari extension in Xcode before submit, I always get this in console:

Failed to load resource: You do not have permission to access the requested resource.

The file is a .txt dictionary file. Manifest v.2 has "web_accessible_resources": [ "diqo.txt" ] and file is in proper folder beside the js.

This works perfectly fine in FireFox and Chrome. I imported the Firefox files to Xcode with:

xcrun safari-web-extension-converter ... --copy-resources --macos-only

in Terminal.

This is my first try at browser extensions. Tried with node, no luck. What I am missing?

// Function to load the lexicon (dictionary) from a text file
const chargerLexique = async () => {
  try {
        const response = await fetch(browser.runtime.getURL('DataJ/diqo.txt'));
        const data = await response.text();
        // Process the text content into a dictionary object
        dictionnaire = data.split('\n').reduce(processLine, {} );
        console.log("Lexiqe de l'extansion bien charjé");
  } catch (error) {
    console.error("Ereur lexiqe:", error);
  }
};
发布评论

评论列表(0)

  1. 暂无评论