relative path resources from JS with HTML imports

后端 未结 2 692
春和景丽
春和景丽 2021-01-15 14:17

I\'ve got a (Polymer) web component that I want to make accessible to people in a cross-origin resource sharing (CORS) fashion. That works fine except I\'m not sure how I c

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 14:49

    I found out that you can access the URL of the import from within a script inside it with document.currentScript.baseURI. I'm doing something like this:

    
    

    One problem: the code above isn't working when I vulcanize everything because the paths change. I'll look into that one a bit later.

提交回复
热议问题