If you're looking for a solution, consider utilizing PhantomJs. I encountered a similar issue in the past but struggled to find a suitable resolution. Personally, I believe that this may offer the best solution.
Here is an example of how my solution looks:
var page = require('webpage').create();
page.open("https://sample.com", function(){
page.evaluate(function(){
var i = 0,
oJson = jsonData,
sKey;
localStorage.clear();
for (; sKey = Object.keys(oJson)[i]; i++) {
localStorage.setItem(sKey,oJson[sKey])
}
});
page.open("https://sample.com", function(){
setTimeout(function(){
page.render("screenshoot.png")
// Specify where to save it
console.log(page.content); // Page source
// jQuery can be used to access its content
var fbcomments = page.evaluate(function(){
return $("body").contents().find(".content")
})
phantom.exit();
},10000)
});
});