maykar / compact-custom-header

This project has been replaced by Custom Header
MIT License
239 stars 31 forks source link

CCH not working with Edge browser #216

Closed IgorMarkovic closed 4 years ago

IgorMarkovic commented 4 years ago

Describe the issue:

It looks like cch is not working in an Edge browser. In de dev console I see the message 'SCRIPT5022: SCRIPT5022: Expected identifier, string or number' as soon as I add the js file to my Lovelace configuration and reload the page. After looking at the js file I see a lot of … (I think it's called 'Spread syntax') which, I think, is not fully supported in Edge: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals Could that be the problem? Or should it work in Microsoft Edge?

Config YAML:

resources:
  - type: module
    url: /local/custom-compact-header/compact-custom-header.js?v=0.0.1
cch:
  clock_date: true
  clock_format: '24'
  date_locale: nl-NL
  options: clock
  swipe: true
  swipe_amount: '10'
  swipe_animate: swipe
  swipe_wrap: false
  voice: hide

HA and/or Browser Error:

SCRIPT5022: SCRIPT5022: Expected identifier, string or number

Versions and Browser:

CCH 1.4.1 Debian with Home Assistant 0.98.5 Microsoft Edge: NOT working, Chrome: Working Storage Mode

maykar commented 4 years ago

Please see the pinned issue:

CCH for older devices & unsupported browsers

IgorMarkovic commented 4 years ago

I already found that post an hour ago, but that also didn't work. I get the following error in the console: SCRIPT5022: SCRIPT5022: SyntaxError on compact-custom-header.legacy.js (481,5)

maykar commented 4 years ago

The spread operator is not used in the legacy file for this reason. This sounds like a cache issue. If you previously used the full version of CCH and didn't change the version number at the end of the resources URL when moving over to the legacy version then do that now.

Edit: Not a spread operator issue, see below.

maykar commented 4 years ago

What version of Edge are you using? I can't get Edge to load Lovelace at all, with or without CCH. Looking at the closed issues on HA's github concerning Edge, it doesn't look like I'll have much luck.

I can confirm that CCH works just fine using the latest beta of Edge, which makes sense since it's based on Chromium. There would be no need for the legacy version on these versions of Edge.

maykar commented 4 years ago

Okay, I may have stumbled on a solution. Looks like MS Edge has issue with an attribute observer's arguments. I've updated the legacy version with a fix. Let me know if it helps.

IgorMarkovic commented 4 years ago

I just tested the new version and it seems to work! Now just hope that Microsoft quickly releases their Chromium Edge browser to the public so we have one browser less to worry about. Thanks for your help with this.