src/drivers/webextension/js/content.js
/**
   * Callback for getTechnologies
   * @param {Array} technologies
   */
Callback for getTechnologies
@param {Array} technologies
Callback for getTechnologies @param { Array } technologies
onGetTechnologies(technologies = []) {
    const script = document.createElement('script')
    script.onload = () => {
      const onMessage = ({ data }) => {
        if (!data.wappalyzer || !data.wappalyzer.js) {
          return
        }
        window.removeEventListener('message', onMessage)
        chrome.runtime.sendMessage({
          source: 'content.js',
          func: 'analyzeJs',
          args: [location.href.split('#')[0], data.wappalyzer.js],
        })
        script.remove()
      }
      window.addEventListener('message', onMessage)
      window.postMessage({
        wappalyzer: {
          technologies: technologies
            .filter(({ js }) => Object.keys(js).length)
            .map(({ name, js }) => ({ name, chains: Object.keys(js) })),
        },
      })
    }
    script.setAttribute('src', chrome.extension.getURL('js/inject.js'))
    document.body.appendChild(script)
  }
onGetTechnologies ( technologies = [ ] ) { const script = document . createElement ( 'script' ) script . onload = ( ) => { const onMessage = ( { data } ) => { if ( ! data . wappalyzer || ! data . wappalyzer . js ) { return } window . removeEventListener ( 'message' , onMessage ) chrome . runtime . sendMessage ( { source : 'content.js' , func : 'analyzeJs' , args : [ location . href . split ( '#' ) [ 0 ] , data . wappalyzer . js ] , } ) script . remove ( ) } window . addEventListener ( 'message' , onMessage ) window . postMessage ( { wappalyzer : { technologies : technologies . filter ( ( { js } ) => Object . keys ( js ) . length ) . map ( ( { name , js } ) => ( { name , chains : Object . keys ( js ) } ) ) , } , } ) } script . setAttribute ( 'src' , chrome . extension . getURL ( 'js/inject.js' ) ) document . body . appendChild ( script ) }
Callback for getTechnologies
 @param {Array} technologies
Callback for getTechnologies @param { Array } technologies
// Inject a script tag into the page to access methods of the window object