[js] Correctly change icon if url is given, closes #4029900 [applied]