electron-api-demos icon indicating copy to clipboard operation
electron-api-demos copied to clipboard

HTML Imports is deprecated and will be removed in M73

Open BenjaminHoegh opened this issue 6 years ago • 10 comments

[Deprecation] HTML Imports is deprecated and will be removed in M73, around March 2019. Please use ES modules instead. See https://www.chromestatus.com/features/5144752345317376 for more details.

BenjaminHoegh avatar Apr 29 '19 10:04 BenjaminHoegh

@BenjaminHoegh do you have an example how to use ES modules instead of soon deprecated HTML imports with <link rel="import" ... > ?

proton1k avatar Jun 13 '19 18:06 proton1k

Does anyone have a solution to this huge issue? Every single Electron example that utilizes more than a single page is entirely dependent on this functionality. Are we stuck having to learn how to incorporate external UI frameworks into Electron instead? If that's the case, it would be nice if there were at least some examples for it from the Electron devs themselves.

hak33m16 avatar Jul 03 '19 23:07 hak33m16

The above is somewhat inaccurate per the link

HTML Imports are deprecated at M70, and will be removed in M80.

We're on M76 in master at present, so consumer apps won't be affected until perhaps ~april 2020 when Electron will likely. with M80.

codebytere avatar Jul 04 '19 01:07 codebytere

@codebytere em... actually for me the text by the link you provided says "HTML Imports are deprecated at M70, and will be removed in M75, around Jun 2019. For more info: https://groups.google.com/a/chromium.org/d/msg/blink-dev/h-JwMiPUnuU/sl79aLoLBQAJ"... 🤔 From their group summary:

2018Q2 (done) Reach out Chrome internal users (e.g. WebUI) Analyze log data (UKM etc.) to identify non-polyfilled users 2018Q3 Start showing deprecation message on dev channel (M70) Proactively drive the usage down 2018Q4 Start showing deprecation message on stable channel (M70) Continue driving the usage down 2019Q1 Disable the feature in M73 (branch Jan. 2019) 2019Q2 Feature disabled in stable, start reverse origin trials for remaining users 2020Q1 Stop accepting origin trials 2020Q2 Remove the code from the code base

But it also seems they're delaying the removal so there's a mismatch. But it will break soon anyway.

proton1k avatar Jul 04 '19 06:07 proton1k

I just dropped this code into the bottom of my body. I still get the warning, but it does the job..

Array.from(document.getElementsByTagName('link')).forEach(item => {
    if(item.rel === 'import'){
      fetch(item.href).
      then(response => { if(!response.ok) throw Error(response.statusText); return response.text() }).
      then(text => {
        const div = document.createElement('replaced')
        item.parentNode.replaceChild(div, item);
        div.innerHTML = text
      }).
      catch(error => console.log(error) );
    }
  });

baash05 avatar Oct 25 '19 03:10 baash05

How about using w3-include-html attribute ? from https://www.w3schools.com/howto/howto_html_include.asp

Dahkenangnon avatar Feb 08 '20 18:02 Dahkenangnon

Any update on this issue? Is there a plan?

enricovittorini avatar Apr 02 '20 18:04 enricovittorini

October 2020, still no reply no plan just a pesky warning from electron-7.2.4 and refusal to import anything when you upgrade to electron-10.1.3 not very serious

audioscavenger avatar Oct 13 '20 16:10 audioscavenger

V>10 doesnot import anything at all.

saquibshaikh14 avatar Nov 15 '20 01:11 saquibshaikh14

Currently using electron ^12.0.2, the solution from @baash05 still works very well over here. Thanks a lot 👍🏼

gabcvit avatar Apr 29 '21 20:04 gabcvit