html - Can't load External Source to <use> tag of SVG -


i got error have no idea how deal it. error is: [from cr]

unsafe attempt load url file:///c:/users/ho%20thi%20kim%20loan/desktop/bete/assets/file-text2.svg#icon-file-text2 frame url file:///c:/users/ho%20thi%20kim%20loan/desktop/bete/index.html. domains, protocols , ports must match. 

my code looks css-trick,

<svg viewbox="0 0 100 100">    <use xlink:href="assets/file-text2.svg#icon-file-text2"></use> </svg> 

my svg:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs>     <symbol id="icon-file-text2" viewbox="0 0 1024 1024">         <title>file-text2</title>         <path class="path1" d="m917.806 229.076c-22.212-30.292-53.174-65.7-87.178-99.704s-69.412-64.964-99.704-87.178c-51.574-37.82-76.592-42.194-90.924-42.194h-496c-44.112 0-80 35.888-80 80v864c0 44.112 35.888 80 80 80h736c44.112 0 80-35.888 80-80v-624c0-14.332-4.372-39.35-42.194-90.924zm785.374 174.626c30.7 30.7 54.8 58.398 72.58 81.374h-153.954v-153.946c22.984 17.78 50.678 41.878 81.374 72.572zm896 944c0 8.672-7.328 16-16 16h-736c-8.672 0-16-7.328-16-16v-864c0-8.672 7.328-16 16-16 0 0 495.956-0.002 496 0v224c0 17.672 14.326 32 32 32h224v624z"></path>         <path class="path2" d="m736 832h-448c-17.672 0-32-14.326-32-32s14.328-32 32-32h448c17.674 0 32 14.326 32 32s-14.326 32-32 32z"></path>         <path class="path3" d="m736 704h-448c-17.672 0-32-14.326-32-32s14.328-32 32-32h448c17.674 0 32 14.326 32 32s-14.326 32-32 32z"></path>         <path class="path4" d="m736 576h-448c-17.672 0-32-14.326-32-32s14.328-32 32-32h448c17.674 0 32 14.326 32 32s-14.326 32-32 32z"></path>     </symbol> </defs> 

the svg image upper belong icomoon

now want know how deal error. of protocols , ports match, , localhost. how on earth have domain? (don't think bug?)

as per @julien comment won't work locally (not in chrome, opera or ie, fine on firefox), need whole on server.

also figured out, in case (as in yours too), matter of removing <defs></defs> element external svg file, prevents content being displayed.

so go ahead , wipe out, , should work expected.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -