app/scripts/contentscript.js
/**
 * Injects a script tag into the current document
 *
 * @param {string} content - Code to be executed in the current document
 */
Injects a script tag into the current document
@param {string} content - Code to be executed in the current document
Injects a script tag into the current document @param { string } content - Code to be executed in the current document
function injectScript (content) {
  try {
    const container = document.head || document.documentElement
    const scriptTag = document.createElement('script')
    scriptTag.setAttribute('async', false)
    scriptTag.textContent = content
    container.insertBefore(scriptTag, container.children[0])
    container.removeChild(scriptTag)
  } catch (e) {
    console.error('MetaMask script injection failed', e)
  }
}
function injectScript ( content ) { try { const container = document . head || document . documentElement const scriptTag = document . createElement ( 'script' ) scriptTag . setAttribute ( 'async' , false ) scriptTag . textContent = content container . insertBefore ( scriptTag , container . children [ 0 ] ) container . removeChild ( scriptTag ) } catch ( e ) { console . error ( 'MetaMask script injection failed' , e ) } }
Injects a script tag into the current document
 @param {string} content - Code to be executed in the current document
Injects a script tag into the current document @param { string } content - Code to be executed in the current document