Browse Source

bugfix clicking on diff image and dataURI

Chrome no longer allows dataURIs to be viewed directly in the URL bar ([background](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/GbVcuwg_QjM%5B101-125%5D)).

Currently clicking on the #image-diff element loads a blank page and gives an error:

> Not allowed to navigate top frame to data URL

This change opens the new window as `about:blank`, creates an image element, and appends that to the page.
pull/132/head
Peter Coles 7 years ago committed by GitHub
parent
commit
8b64a9f532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      demoassets/main.js

14
demoassets/main.js

@ -60,7 +60,19 @@ $(function(){
$('#image-diff').html(diffImage); $('#image-diff').html(diffImage);
$(diffImage).click(function(){ $(diffImage).click(function(){
window.open(diffImage.src, '_blank'); var w = window.open("about:blank", "_blank");
var html = w.document.documentElement;
var body = w.document.body;
html.style.margin = 0;
html.style.padding = 0;
body.style.margin = 0;
body.style.padding = 0;
var img = w.document.createElement("img");
img.src = diffImage.src;
img.alt = "image diff";
body.appendChild(img);
}); });
$('.buttons').show(); $('.buttons').show();

Loading…
Cancel
Save