I am trying to open a debug window within Javascript. Javascript will pass the debug window a JSON string which JSONView (a Chrome extension) should display in a nicely form
It is not possible.
You'd be better off doing:
console.log(JSON.parse($(".trend_chart").attr("data-trendChart")));
The document that your opening should be of type "application/json
" you cannot send it as a parameter in the window.open method since it's out of context. The browser instead is the one that determines the file type using the request headers.
window.open("http://www.yoursite.com/file.json", "mywindow");
You should see the json file within JSONView without problems. If the browser still asks you to download the file, your installation of JSONView is probably broken.