Pass a variable to Javascript directly from – Basj Dec 21 '20 at 13:50

  • 6
    @Basj [`document.currentScript`](https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript) – Ivar Dec 21 '20 at 13:51
  • 0
    let me = document.querySelector('script[src$="lib.js"]');
    me.getAttribute("site");
    

    In addition to the answers above, this script will let you have more freedom to change the script's file name or path

    nourhomsi
    • 323
    • 1
    • 11