Ok so this unfortunate task is due to a bug in chrome which I determined in another question: Loading resources from html5 filesystem api
What I need to do is go through all the resources that may come from downloading a website, and turn any relative urls into absolute urls, in Javascript. What I could use help with is coming up with all of the cases I am going to have to handle. Here’s what I can come up with:
- in html / xhtml / xml => anything with an href or src attribute
- in css => anything that matches a /url(.*)/ regex\
- javascript => probably not possible…
Is there anything else I am not thinking of?
Unless you’re using jQuery or similar I’d just bite the bullet and attack the entire page source.
How you determine is up to you, could inject it into your doc.onready function or otherwise inject a global var into the document somewhere.