0

I want to use leaflet API and it needs the following script tag.

<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"
   integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log=="
   crossorigin=""></script>

Now Require and getScript allows you to add the js files that we need to include but how do i add the integrity attribute. I don't have access to html, so can we add the integrity and crossorigin attributes while we include js files with getScript or require.

Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317
ks kumar
  • 1
  • 2
  • Adding the attributes is the issue. I definitely have no problem with including the js file if you read carefully. – ks kumar Dec 13 '17 at 10:23
  • Please look again on the link. The first answer tells you directly how: `whatevert.setAttribute('integrity','sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log==');` – Doomenik Dec 13 '17 at 10:39

0 Answers0