Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created September 13, 2010 00:54
Show Gist options
  • Save rwaldron/576663 to your computer and use it in GitHub Desktop.
Save rwaldron/576663 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="foo.js">
{
"foo" : "bar"
}
</script>
</head>
<body>
</body>
</html>
document.addEventListener('DOMContentLoaded', function (e) {
var scripts = document.getElementsByTagName('script'),
length = scripts.length, i = 0,
objects = [];
for ( ; i < length ; i++ ) {
console.log(JSON.parse(scripts[i].innerHTML));
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment