Application.OpenURL not working with Data URI

If you enter the following URI in the browser:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==

it will show a 5x5 pixels red circle.

I’m trying to do this inside Unity with Application.OpenURL or Application.ExternalEval("window.open(url,'_blank')") but it does nothing. It doesn’t work on editor nor on Mac build, but strangely it works on the Web Player (and that’s why I think my code is working).

Yeah I just tested it and it looks like the OpenURL function will only allow the http: and https: protocols.
This makes what you are trying to do a bit more complicated… You could use OpenURL to open a php page and pass the image info as a GET variable. Then the php page could open the image for you. So it might look something like:

var open_url = "http://yourdomain.com/open_image.php";

open_url += "?imageinfo=" + ImageBytes; //add your image byte array

Application.OpenURL(open_url);

Then the php file could look like this:

<?php

if(isset($_GET['imageinfo']))
{
  $image_info = $_GET['imageinfo'];
  $data_URI = "data:image/png;base64,";

  echo "<meta http-equiv='refresh' content='0;url=".$data_URI."".$image_info."'>";
}

?>

Here’s an example project using this method.

OpenURL.zip

Note that the server the php page is hosted on is currently really slow, so it takes a few seconds before it redirects to the actual image… With a proper server on a normal webpage the load time should normally be under a second.