Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9069147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:21:10+00:00 2026-06-16T17:21:10+00:00

I am trying to make a chrome extension that will display a popup in

  • 0

I am trying to make a chrome extension that will display a popup in my Gmail that will contain some information from my external server, say today’s weather.

What I have tried

  1. I have tried including the js in the chrome extension, but then trying to make an AJAX call to my server violates the same-origin policy. So that option didn’t work.
  2. So then I tried keeping my js file on the server and loading it on page load.

My manifest.json looks like this:

{
  "name": "cvnosnvsdionfois",
  "version": "0.1.0",
  "manifest_version": 2,
  "description": "sldnfksdngsdngods",
  "browser_action": {
    "default_icon": "images/icon.png"
  },
  "permissions": [
    "http://api.flickr.com/", "webRequest",
    "tabs", 
    "http://*localhost:8080*"
  ],
 "content_scripts": [
    {
      "matches": ["https://mail.google.com/*"],
      "js": ["http://localhost:8080/static/response.js"]
    }
  ]
}

I have read elsewhere that Content scripts cannot be included from an external URL, so I figure that this will not work. What is the right approach here. How can I have some javascript code that runs in Gmail, that can request information from my server? For example, how does Smartr do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:21:11+00:00Added an answer on June 16, 2026 at 5:21 pm

    I ain’t sure why Cross-Origin XMLHttpRequest did not work because Extensions aren’t so limited like Regular web pages that can use the XMLHttpRequest object to send and receive data from remote servers and are limited by the same origin policy. An extension can talk to remote servers outside of its origin, as long as it first requests cross-origin permissions.

    References:

    • Cross-Origin XMLHttpRequest
    • Permissions

    Demonstration

    This sample code uses background page to make XHR for another domain.

    manifest.json

    I ensure manifest has all permissions available and also registered a background page.

    {
      "name": "Demo",
      "description": "Sample Message Communication",
      "version": "1",
      "permissions": [
        "<all_urls>"
       ],
      "background": {
        "scripts": ["background.js"]
      },
    
      "manifest_version": 2
    }
    

    background.js

    This sample code make a request for some random asp page

    function makeXHR() {
    
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function (data) {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                      console.log("Response is received");
                }
            } else {
                //callback(null);
            }
        }
    
        var url = 'http://www.w3schools.com/html/default.asp';
        xhr.open('GET', url, true);
        xhr.send();
    
    }
    document.addEventListener("DOMContentLoaded", makeXHR);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a Chrome extension that will search different cache databases for
I'm trying to make a chrome extension on my toolbar that, when clicked, will
I'm trying to make an extension for google chrome. It will automatically click on
I am having some issues with an extension that i am trying to make.
I'm trying to make an extension that crashes all tabs in chrome window so
I'm trying to create a Chrome extension that will reload touch.facebook.com every 10 minutes
I'm trying to make a Chrome extension that gets the current page's URL and
I am trying to make a Chrome extension for personal use that makes all
So I'm trying to make a Chrome extension that takes in user input in
Since it seems none exist, I'm trying to make a chrome extension to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.