1

I have to develop a chrome extension for my thesis which does following analysis:

This extension should analyse the javascript files (.js) and webssembly files (.wasm) of visited webpages. For example i have to check if a javascript file contains a special string X. In somepages included files are on visited domain in somepages on another domain. Via security reasons maybe it would be diffucult to get content of these files. Is it possible to get content of these files as a variable?

ColinE
  • 68,894
  • 15
  • 164
  • 232
Micheal Toru
  • 422
  • 4
  • 28

1 Answers1

2

Get file contents with jquery

jQuery.get('http://localhost/filename.ext', function(data) {
    var jsFile = data;
});
Syed Waqas Bukhary
  • 5,130
  • 5
  • 47
  • 59
  • i get following error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ***************** is therefore not allowed access. The response had HTTP status code 400. – Micheal Toru Feb 03 '18 at 18:02
  • This is a separate issue, hence a separate question ready resolved in this question https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present. you are reading the URL of a different domain. Look at "Using CORS." – Syed Waqas Bukhary Feb 03 '18 at 18:06
  • And is there any option to get the content via chrome sources? is there any special permission for chrome extensions to read content of loaded files? – Micheal Toru Feb 03 '18 at 22:02