1

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 :)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.