0

I am trying to inject TextExtractor2.js written in brython into every loaded webpage using the content_scripts way, all my extension code is here, but the chrome console shows TextExtractor2.js:2 Uncaught SyntaxError: Unexpected identifier

So anyone can help ?

iMath
  • 2,326
  • 2
  • 43
  • 75
  • brython patches ` – wOxxOm Feb 18 '20 at 10:04
  • @wOxxOm I think I am using the same method as that of injecting jquery mentioned in https://stackoverflow.com/a/21317597/1485853 the way works , but why I failed here? I cannot tell the difference – iMath Feb 18 '20 at 10:33
  • Like I said content scripts don't run as ` – wOxxOm Feb 18 '20 at 11:22
  • @wOxxOm Sorry, I don't understand what you mean. As an example, I am going to inject TextExtractor2.js into every loaded webpage , so does the iframe stuff you mentioned help ? – iMath Feb 18 '20 at 14:01
  • 1) Content scripts are different from normal page scripts so brython can't process them. 2) Using an iframe you can craft a normal html page that brython can process. That iframe will be appended to a web page, and inside the iframe you can display your UI or do other stuff. – wOxxOm Feb 18 '20 at 14:42
  • @wOxxOm Thanks again ! I think I have to specify my aim here. Suppose I want to get the text content from the element I clicked in every loaded webpage with my Chrome extension, I could work this out via vanilla JavaScript, I wonder whether the same could be achieved with brython, is the brython version porting feasible? – iMath Feb 18 '20 at 15:14
  • AFAICT it won't work with content scripts. – wOxxOm Feb 18 '20 at 15:35

0 Answers0