Creating an Extensions that needs to redirect Error 500 Internal Server Page to a custom page

I would like to ask your assistance on how I can possibly redirect properly the Error 500 Internal Server page only to a custom page and otherwise our webpage will be accessible. Currently, I have a code but even our system is accessible it’s still redirecting to a custom page

My background.js

function redirect(requestDetails) {
  console.log("Redirecting: " + requestDetails.url);
  return {
    redirectUrl: ""


My manifest


  "description": "Intercept and Redirect Error 500 Page",
  "manifest_version": 2,
  "name": "Web Request",
  "version": "12.8.2018",
  "icons": {
        "24": "icons/24.png",
        "48": "icons/48.png",
        "128": "icons/128.png"
  "browser_action": {
        "default_icon": "icons/48.png"

  "permissions": [

  "background": {
    "scripts": ["background.js"]


I have read that onBeforeRedirect can achieve my needs but I don’t have any idea how to code it.


Google Chrome Extension: How to detect «This site can’t be reached»

I develop extension for Google Chrome (something like proxy).

But how can i detect error «This site can’t be reached» (DNS_PROBE_FINISHED_NXDOMAIN).

Cryptocurrency data based on Twitter trending chrome extension

I already built the basics but I’m having problems with connecting Twitter and Google Sheets API.

Does anyone have any documentation that I could follow through? I’m not really sure what codes to write in background.js and content scripts. I really need your help.

Thanks a lot!

Transfer execution to another javascript file from one javascript file

I am learning to use webAPIs in javascript by implementing a dictionary api. I want to get input in variable word from the popup of the chrome extension using the file popup.js.

Problem: I want to store this word and pass it to another file script.js which contains the API call to search for the definition of this word and return it back to the extension.js file to display it back in the popup. How to implement this?

What I looked up was to use global variables by calling the file containing the declaration of the global variables ie. first extension.js, somehow transfering its execution to script.js and then returning the result back to extension.js. How to transfer this execution? Or is there a cleaner way of doing this? Also, is there a better way than using global variables to pass info between two javascript files.

These are the codes, I have written so far-





var url = '' + word;
var request = new XMLHttpRequest();'GET', url, true);
request.setRequestHeader('accept', "application/json");

request.onload = function() {
    //Begin accessing JSON data here

    var data = JSON.parse(this.response);
    definition = data.results[0].senses[0].definition;
    definition = definition.charAt(0).toUpperCase() + definition.substr(1);



var word, definition;

document.addEventListener('DOMContentLoaded', function() {
    document.getElementById('status').textContent = "Extension loaded";
    var searchButton = document.getElementById('searchButton');

    searchButton.addEventListener('click', function() {

        var word = $('#textInput').val();
            $('#status').html("Please enter a word");

    addButton.addEventListener('click', function() {
        $('#status').html('The word is added to the list');

Anybody willing to give any advice would be very helpful. Any help is greatly appreciated!

Chrome extension API for web categorization

I have a Google Chrome extension that generates a popup with the following data:
date, time spent, url. I would like to know how to automatically categorize the url and place that in my popup. I can see that there are many free web categorization APIs online but I am not sure which would be appropriate for a Chrome extension. Please advise what API might be the best choice for this application.

Running separate timers for different opened web pages in javascript

I am making a chrome extension where I need to keep record of time spent on different web pages.
I want timer to stop if some webpage is closed after bit of usage and start timer again from it’s previously saved value if web page is reopened.

I am totally new to chrome extensions. Can anyone please guide a bit on this.


Restrict exposing certain request headers for REST API in browser

I am fetching a GET API using the fetch command in react. When I run the production build, I can see the x-api-key in request header when I inspect in either Google/Firefox (network). This is the API key that my web app uses to make the request and I don’t want it to get exposed in the browser’s devtools. Any ideas on how to achieve this?

How to add custom alert in Google Chrome Extension?

I’d like to be able to display a styled alert (for example, add image) which the alert dialog is called from the background script of a Chrome Extension (I want to write the code of alert in background.js). Is there any idea how I can display the alert? Is there an APIs Chrome Extension for that?
I have a simple alert without styled :

chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab){
    if(changeInfo.status == 'complete' && tab.status == 'complete'){

 alert("This is a simple alert!");

  }   });

http ajax call inside Google Extension

I have a simple google extension that calls a Web API with HTTP Url

In the customscript.js file, I have the below ajax call

function Getresponse()
   return $.ajax({
       url: "http://url",
       crossDomain: true,
       async: false,
       success: callback

I have now two behaviors,

  1. When open HTTP page then click on the google extension icon, it is working properly and I get the response from the API without any issue.

  2. When open HTTPs page then clicks on the google extension icon, it’s not working by any means.

I traced the issue and made sure that this is because of the API URL is HTTP, not HTTPS

My question is How can call HTTP API in google extension whatever the current page is HTTP or HTTPS?

How to make common authentication between 2 server – Rails & Django

the service I’m developing consists of chrome extension & web application.
For it I’m trying to create 2 server:

  • web application server (build by Rails)
  • API server(build by Django) to receive requests from chrome extension and process user data.

Those application use same database, same user information.

My question is how to authenticate users — in Rails app, users can sign-up and sign-in via form. But in API server, how to authenticate users?

One solution might be JWT authentication, user get JWT token from Rails server and send token to Django server, and Django server authenticate by JWT authorization.

Is that best practice — or simply sending username & password is better then this?