JS Loalization
-
Hi,
I understood that js file can be localized if it’s called with <script …> tag.
I’ve got a shipping plugin which use an openstreetmap, and so, it calls leaflet.js from this url:
https://unpkg.com/[email protected]/dist/leaflet.jswith this code:
<?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?> <script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-o9N1jGDZrf5tS+Ft4gbIK7mYMipq9lqpVJ91xHSyKhg=" crossorigin=""></script>
I used this url for localizing it, it works, but the browser continues loading “unpkg.com/[email protected]/dist/leaflet.js” (or rather “tries” to load, because it’s blocked by CSP policy… even in adding this url in script-src CSP policy in header.php).
Could it be the integrity tag the culprit ?
I suppose that the plugin uses the localized js file as the map is displayed while https://unpkg.com/[email protected]/dist/leaflet.js can not be loaded !
Any idea for helping me to clarify this ?
Thanks a lot.
- The topic ‘JS Loalization’ is closed to new replies.