Import js from script tag in HTML file. Possible?

前端 未结 3 428
抹茶落季
抹茶落季 2021-01-12 06:09

I want to access data from script tag in html file, produced by cms. Is it possible to do this without polluting global namespace? I\'ve tried to use es6 modules but I\'ve

3条回答
  •  -上瘾入骨i
    2021-01-12 06:32

    I also asked myself the same question and found your topic. But then a simple solution came to mind.

    // buffer.js
        export default let buffer={};
    
    // index.html
    
    ....
    
    

提交回复
热议问题