extension.getBackgroundPage()
  
   Returns the Window of the background page if the background script is running. If the script is not running, null is returned.
   This a synchronous function.
   
   
  
   Syntax
   
    
     let page = browser.extension.getBackgroundPage()
     
    
  
  
  
   Return value
   
    object. Window of the background page or null.
    
  
  
   Examples
   
    Suppose a background script defines a function foo():
    
     
function foo() {
  console.log("I'm defined in background.js");
}
     
    A script running in a popup can call this function directly like this:
    
     
let page = browser.extension.getBackgroundPage();
page.foo(); 
     
    
  
  
  Browser compatibility
  
   
    
     
      
       |  | Desktop | Mobile | 
      
       |  | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | 
     
     
      
       | getBackgroundPage | Yes | 14 | 45 | ? | Yes | 14 | ? | ? | 48 | ? | 15 | ? |