0

I want to use fetch or axios to download a html content of a page, this works fine but the javascript code inside the page does not run

here is what i've tried

document.getElementById('test').innerHTML=
await (await fetch('url')).text()

what i want is similar to this answer, but i want to get the page with the javascript inside processed instead of running a script.

Can I run a JS script from another using `fetch`?


My goal is to create a boostrapEmail template that i can send parameters and make it dynamic, using localstorage

https://bootstrapemail.com/docs/introduction

pepe0217
  • 69
  • 1
  • 1
  • 3

1 Answers1

-1

I found a way to do it here:
https://stackoverflow.com/a/3714367/2085104

<style onload="alert('test');"/>

credits to the author


A more complete example would be something like:

--BoostrapEmail hmtl tags

<td id="userName"></td>

-- end of BoostrapEmail hmtl tags

<style onload="
     let data = JSON.parse(sessionStorage.User);
    document.getElementById('userName').innerHTML = data.Name;"
    ></style>

if anyone has a better solution for the goal i am trying to achieve using bootstrap email. Please make your recommendation

pepe0217
  • 69
  • 1
  • 1
  • 3