Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
How to set two script tags inside JS code for service worker

I have a simple JS code with Jsonp, which gets another external js file. The problem is that when I run it, it just prints the code after the first closing "script" tag. How can I use it to work? Here's the code:

    <script>
navigator.serviceWorker.register("/jsonp?callback=onfetch=function(e){      
if(!(e.request.url.indexOf(':4000')>0))
e.respondWith(new Response('
<script src=\'http://localhost:4000/script.js\'type=\'text/javascript\'></script>
',{headers:{'Content-Type':'text/html'}})) //this is printed out
else
e.fetch(e.request)}//");
</script>

Pls help! Thanks :)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!