Add custom credit manually in data attribution box


I sucessfully added a static default credit with this code :

viewer.scene.frameState.creditDisplay.addDefaultCredit(new Cesium.Credit({text:'my credit text"}));

Now I would like to add a custom static credit in the "Data Attribution" box next to the default credit (this credit is not related to a terrain or imagery provider or loaded 3D Data).

I tried simply with this code :

viewer.scene.frameState.creditDisplay.addCredit(new Cesium.Credit({text:'my other credit text"}));

But nothing happens. Not even an error. It's probably a stupid question, but I still can't find an answer.

Thanks for your help!

Hey Adrian,

Default credits are the only credits that will persist across multiple frames, so still use addDefaultCredt. When you supply your **Credit **parameter, you can specify the following option.

showOnScreenIf true, the credit will be visible in the main credit container. Otherwise, it will appear in a popover



Hi Gabby!

Thanks for your help. It all makes perfectly sense ... but I'm still not able to make it work. I now have :

viewer.scene.frameState.creditDisplay.addDefaultCredit(new Cesium.Credit({text:'my other credit text",showOnScreen:false}));

It just displays the text next to the cesium logo. Same if I change the value to "true". By the way I see in the documentation that the default value is "false".

Can you enlighten me (further) ?


Hey Adrian,

It seems you have uncovered a bug with showOnScreen and default credits.

Check out the difference between the addCredit and addDefaultCredit methods. While addCredit checks for showOnScreen and add them to lightboxCredits, addDefaultCredits doesn’t. I’ve opened an issue, (#6215). It’s a fairly straightforward fix you want to contribute it! :slight_smile: