先日、こちらに質問し、faviconは出現するようになったのですが、
不安定で基本的に表示されません。
選択し右クリックで、「」を検索とした時のみ確実にfavion表示されます。
また、たまに以下のエラーが表示されます。
script.js:16 Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
javascript
1$(function(){ 2 function attachFavicon(){ 3 console.log('start!'); 4 $("h3.r a").each(function(){ 5 console.log('between'); 6 var domain = this.host; 7 var favget = "//www.google.com/s2/favicons?domain="+domain; 8 var favgethtml = "<img src='"+favget+"' class='favi'/>"; 9 $(this).parent().prepend(favgethtml); 10 }); 11 } 12 13 const mo = new MutationObserver(_ => { 14 attachFavicon() 15 }) 16 mo.observe($("#search").get(0), {childList: true}) 17 //attachFavicon() 18})
json
1 "content_scripts": [ 2 { 3 "matches": ["https://www.google.co.jp/*"], 4 "js": ["jquery.min.js","script.js"], 5 "run_at" :"document_start" 6 } 7 ] 8 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。