The problem here is with the opening address. If you delete the link imageand open a blank document, you will have a background set.
I suspect this is due to the headers on the first load of the resource. With the image, the type of content will matter image/jpegor something else, but then we try to manipulate the document as if it were text/html.
function openLarge() {
var image = $('main-image').href;
NewWin = window.open('',"LargeImage","resizable=yes,scrollbars=auto,status=no,width=710,height=510");
NewWin.document.writeln("<body bgcolor='#fff'>");
NewWin.document.writeln("<img src='" + image + "'>");
NewWin.document.writeln("<\/body>");
NewWin.document.close();
}
source
share