0

I have an unexpected fault in my code. The code is inside chrome extension made by my friend, but I'm rigt now unable to contact him. Extension works fine until now, so I don't know what happens during last weeks (maybe some updates...)

Fault: Uncaught ReferenceError: myFunction is not defined

So, problem is in this part of my code in bookmarklet.js

oknoObsah=oknoObsah+"<td align='center'><img onclick=\"setTimeout(function(){myFunction('"+encodeURIComponent(images[i].src)+"');}, 3000);document.getElementById('"+i+"').style.border='3px solid red';oldVybrano=document.getElementById('vybrano').value; if(oldVybrano!='' && oldVybrano!="+i+")document.getElementById(oldVybrano).style.border='0px solid red';document.getElementById('vybrano').value="+i+";\" src='"+images[i].src+"' id='"+i+"'  style='max-height:75px; max-width:75px; border: 0px solid red;'></td>";

Any idea what is wrong?

  • Without seeing a demo that I can test myself it sounds like https://crbug.com/912069 which was broken in Chrome 71 and fixed in 72. Either use a newer Chrome like a separately installable Canary or rework your content script so that part runs inside a page-level script ([more info](https://stackoverflow.com/a/9517879)). – wOxxOm Jan 03 '19 at 13:23
  • You can try the app --> https://chrome.google.com/webstore/detail/post-to-wikidiyorg/ofdiejblenchnmhokkkghfmpfglgjfhp – Wikidiy Org Jan 03 '19 at 13:25
  • Problem is, that through this extension you can chose any image from previously visited page and this image will be sent to WikiDIY form...this function is not working now... – Wikidiy Org Jan 03 '19 at 13:26
  • Yep, my guess was right. See the "more info" link I gave. – wOxxOm Jan 03 '19 at 13:28
  • Ok, thanks for this link. But I'm not experienced coder :-/, any hint how to solve it in my case? – Wikidiy Org Jan 03 '19 at 14:01
  • Try replacing okno.document.write(oknoObsah) with the following code (make sure to reload the extension in the browser): okno.document.write('') – wOxxOm Jan 03 '19 at 14:32
  • Not working :-( – Wikidiy Org Jan 03 '19 at 14:49
  • Remove both lines with document.open and document.write and put this: okno.document.documentElement.appendChild(okno.document.createElement('script')).text = 'document.write(' + JSON.stringify(oknoObsah) + ')' – wOxxOm Jan 03 '19 at 21:06
  • YOU ARE THE BEST! Thank you – Wikidiy Org Jan 04 '19 at 07:08

0 Answers0