Hello.

I have a html-page with such source:
Qt Code:
  1. <html>
  2. <head lang="en">
  3. <script src="http://example1.com/script1.js"></script>
  4. <script src="http://example2.com/script2.js"></script>
  5. </head>
  6. <body>
  7. ...
  8. </body>
  9. </html>
To copy to clipboard, switch view to plain text mode 
Each of included java-scripts has code like:
Qt Code:
  1. (function(){
  2. var s = document.createElement('script');
  3. var x = document.getElementsByTagName('script')[0];
  4. s.type = 'text/javascript';
  5. s.async = true;
  6. s.src = ('https:'==document.location.protocol?'https://':'http://')
  7. + '<exampleA.com>/<scriptA>-1.js';
  8. x.parentNode.insertBefore( s, x );
  9. })();
To copy to clipboard, switch view to plain text mode 
It means that each of these js-files includes one more external js-file (here is <exampleA.com> should be replaced with example1.com or example2.com, and <scriptA> also should be replaced in the same way).

As a result I have on my page loaded scripts:
* http://example1.com/script1.js,
* http://example1.com/script1-1.js,
* http://example2.com/script2.js,
* http://example2.com/script2-1.js.

Now I need to load my page with QNetworkAccessManager::createRequest() but it's necessary to know who requested each resource. In my example files http://example1.com/script1.js and http://example1.com/script1-1.js were requested by source page, script http://example1.com/script1-1.js was requested by script on example1.com, script http://example2.com/script2-1.js - by script on example2.com. As a result I need to build tree like this:

source
  • example1.com
    • script1.js
    • script1-1.js
    • script1-2.js
  • example2.com
    • script2.js
    • script2-1.js
    • script2-2.js
    • <...>
    • script2-N.js
  • example3.com
    • script3.js
    • script3-1.js
    • script3-2.js
    • <...>
    • script3-N.js


Do you have any ideas how to do it?