humanswitch/consentcookie

missing icon shows 'broken' image

Closed this issue · 1 comments

If an application image is missing the image shows as a broken image.

In previous versions it just doesn't show. That is a better solution.

Description

In version 1.0.0 the image of an application shows as a broken image. In revision 150a0a6 it just doesn't show.

Expected Behavior

No application icon available then just don't show.
screen shot 2018-10-03 at 08 40 58

Actual Behavior

It shows a broken image
screen shot 2018-10-03 at 08 10 55

Possible Fix

Steps to Reproduce

I used a custom application without filling in the iconurl.

Put code from below in a testpage.

<script type='text/javascript' src='https://cdn.humanswitch.services/cc/consentcookie/app/1/consentcookie.min.js'></script>
<script type='text/javascript'> window.ConsentCookie.init({"general":{"uuid":"f214c780-c6d2-11e8-998e-6fbaff97eac7","generatedBy":"_2.0.1","consent":{"type":"application"},"gdpr":{"contact":"https://www.christianvriens.com"},"consentwall":{"enabled":true,"timeout":1000},"language":{"default":"en","fallback":"en"}},"apps":{"consent":{"testapp":{"initstate":"optin"},"aco":{"dataProcessings":[],"initstate":"optin"}},"endpoint":"","static":{"nl":[{"id":"iq","name":"IQNOMYapp","company":"HumanSwitch","description":"Deze app wordt gebruikt om CC te testen","icon":"//cdn.humanswitch.services/cc/consentcookie/logo/ga.png","infolink":{"connection":"https://analytics.google.com","profile":"https://analytics.google.com"},"dataProcessing":[{"id":"ga","dataIds":{"cookies":["_ga","__utma","__utmb"]}}],"plugin":"https://cdn.humanswitch.services/cc/consentcookie/plugins/google-analytics/plugin.js"}],"en-US":[{"id":"testapp","name":"TestApp","company":"HumanSwitch","description":{"connection":"Thisappisfortestingpurposes","profile":""},"icon":"//cdn.humanswitch.services/cc/consentcookie/logo/ga.png","infolink":{"connection":"https://analytics.google.com","profile":"https://analytics.google.com"},"dataProcessing":[{"id":"ga","dataIds":{"cookies":["_ga","__utma","__utmb"]}}],"plugin":"https://cdn.humanswitch.services/cc/consentcookie/plugins/google-analytics/plugin.js"}]}},"design":{"layout":{"position":"right"},"colorscheme":{"primary":"#2F3499","secondary":"#B7BAFE"}},"resources":{"en":"en-US","en-US":{"general":{"on":"on","off":"off","close":"close","moreInfo":"Moremore"},"menu":{"applications":"Yourconfiguration","about":"AboutCC","open":"OpenCC","close":"CloseCC","disabled":"Firstaccepts"}}},"purposes":{"consent":{"ccp-ot":{"initstate":"optin"}}}}				);
</script>

Context

Your Environment

  • Version used: 1.0.0
  • Browser Name and version: chrome
  • Operating System and version (desktop or mobile): mac

@christianvriens Thank you for the testcase. Was easy to reproduce like this.

Not sure if it was an regression bug, but I think it always has worked like this.
The image used for the app does not exist so the img src tries to load a nonexisting picture.

Created a fix to make the img handling loading errors and when not able to load, the img element opacity will be 0.