Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

83
Visualizações
How to inject inline script when Content Security Policy is preventing it?

I'm using Chrome Extension ReactJS which I'd like to insert this in popup.html:

<script src="https://unpkg.com/ringcentral-c2d@1.0.0/build/index.js"></script>
<script>
  window.clickToDialInject = new RingCentralC2D();
  window.clickToDialInject.on(
    RingCentralC2D.events.call,
    function (phoneNumber) {
      console.log('Click To Dial:', phoneNumber);
      chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        const currentTabId = tabs[0].id;
        chrome.tabs.sendMessage(currentTabId, { clickToCall: phoneNumber });
      });
      // alert('Click To Dial:' + phoneNumber);
    }
  );
  window.clickToDialInject.on(
    RingCentralC2D.events.text,
    function (phoneNumber) {
      console.log('Click To SMS:', phoneNumber);
      chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        const currentTabId = tabs[0].id;
        chrome.tabs.sendMessage(currentTabId, { clickToSMS: phoneNumber });
      });
      // alert('Click To SMS:' + phoneNumber);
    }
  );
</script>

I am having this error in console. I already tried the meta tag but I cant figure out what directive should I use.

enter image description here

Right now, it only works if I directly paste the script from https://unpkg.com/ringcentral-c2d@1.0.0/build/index.js inside the popup.jsx, but its not appropriate way.

How could I overcome this?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda