• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    XMLHttpRequest called from extension stopped working

    Opera add-ons
    1
    2
    400
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Former User
      A Former User last edited by

      Hi everybody! I have a tiny extension that reports Opera's active tab to a Mac time tracker running locally.

      It uses the same code for Chromium, Firefox, and Opera but recently it stopped working in Opera. It seems that XMLHttpRequest can't be sent anymore.

      How can I work around that? Is there any new permission I'm missing? Thanks!

      The extension and the manifest code:

      function checkUrl() {
        chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
          if (tabs.length > 0) {
            var tabUrl = tabs[0].url;
            var tabName = tabs[0].title;
            var isIncognito = tabs[0].incognito;
            console.log(tabUrl + " " + tabName + " " + isIncognito);
            var requestUrl = "http://localhost:27272/?url=" + encodeURIComponent(tabUrl) + "&title=" + encodeURIComponent(tabName) + "&private=" + isIncognito;
      
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open("POST", requestUrl, true);
            xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttp.send(null);
          }
        });
      }
      
      chrome.tabs.onActivated.addListener(function(info) {
        checkUrl();
      });
      
      chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
        checkUrl();
      });
      
      chrome.windows.onFocusChanged.addListener(function(windowId) {
        checkUrl();
      });
      
      {
        "description": "Extension to communicate with Qbserve time tracker",
        "manifest_version": 2,
        "name": "Qbserve",
        "version": "1.5",
        "homepage_url": "https://qotoqot.com/qbserve/",
        "icons": {
          "32": "icons/qbserve-32.png",
          "48": "icons/qbserve-48.png",
          "64": "icons/qbserve-64.png",
          "96": "icons/qbserve-96.png"
        },
      
        "permissions": [
          "tabs",
          "http://localhost:27272/*"
        ],
      
        "background": {
          "scripts": ["qbserve.js"]
        }
      }
      
      Reply Quote 0
        1 Reply Last reply
      • A Former User
        A Former User last edited by

        Anyone?

        Reply Quote 0
          1 Reply Last reply
        • First post
          Last post

        Computer browsers

        • Opera for Windows
        • Opera for Mac
        • Opera for Linux
        • Opera beta version
        • Opera USB

        Mobile browsers

        • Opera for Android
        • Opera Mini
        • Opera Touch
        • Opera for basic phones

        • Add-ons
        • Opera account
        • Wallpapers
        • Opera Ads

        • Help & support
        • Opera blogs
        • Opera forums
        • Dev.Opera

        • Security
        • Privacy
        • Cookies Policy
        • EULA
        • Terms of Service

        • About Opera
        • Press info
        • Jobs
        • Investors
        • Become a partner
        • Contact us

        Follow Opera

        • Opera - Facebook
        • Opera - Twitter
        • Opera - YouTube
        • Opera - LinkedIn
        • Opera - Instagram

        © Opera Software 1995-