Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: components/physical_web/webui/resources/physical_web.js

Issue 2717363003: Add Physical Web WebUI Default Url Icon (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/physical_web/webui/resources/physical_web.js
diff --git a/components/physical_web/webui/resources/physical_web.js b/components/physical_web/webui/resources/physical_web.js
index 418dc1d6e90c1b5e8daffb35b8fbd841900eae08..e9f596e8730aeefc132aab122e57366996918a98 100644
--- a/components/physical_web/webui/resources/physical_web.js
+++ b/components/physical_web/webui/resources/physical_web.js
@@ -24,8 +24,18 @@ function physicalWebItemClicked(index) {
function returnNearbyURLs(nearbyUrlsData) {
var bodyContainer = $('body-container');
renderTemplate(nearbyUrlsData);
-
bodyContainer.style.visibility = 'visible';
+ addErrorHandler();
+}
+
+function addErrorHandler() {
+ var images = document.getElementsByTagName('img');
mattreynolds 2017/02/28 22:20:54 Can we make this only match favicon images? If we
+ for (var i = 0; i < images.length; i++) {
cco3 2017/02/28 22:10:49 I know you are working with some old version of jq
+ var img = images[i];
+ img.addEventListener('error', function() {
+ this.src = "chrome://physical-web/link.png";
+ });
+ }
}
document.addEventListener('DOMContentLoaded', requestNearbyURLs);

Powered by Google App Engine
This is Rietveld 408576698