Display base64 string image as a hyperlink
<p>I am trying to display an image that is already converted into a base64 string as a link inside "a href" tag. </p>

<p>Java Method:</p>

<pre><code>public void TakeScreenShot (String ScenarioName, String Description,JsonHtmlDataHelper jsonHtmlDataHelper)
{
    TakesScreenshot takeScreenshotDriver = (TakesScreenshot) driver;
    byte[] screenshotData = takeScreenshotDriver.getScreenshotAs(OutputType.BYTES);
    JsonObject jsonObjectHtmlReport = new JsonObject();
    jsonObjectHtmlReport.addProperty("ScenarioTest", ScenarioName);

    String imageData = Base64.encodeBase64String(screenshotData);
    String imgTag ="&lt;img src=\"data:image/png;base64, " + imageData + "\" width=\"200\" height=\"150\"/&gt;";
    System.out.println(imageData);
    jsonObjectHtmlReport.addProperty("TestStepDescription", imgTag);
    jsonObjectHtmlReport.addProperty("TestStepResult","PASSED");
    jsonHtmlDataHelper.AddProperty(jsonObjectHtmlReport);
}  
</code></pre>

<p>The above method displays the image in HTML correctly but I want to add a link that redirects the page to the this image. According to the requirement, I cannot store the image anywhere. </p>

<p>I have tried the following: </p>

<pre><code>&lt;a rel=\"group\" href='#' onclick=\"$.fancybox.open({href:'data:image/png;base64," +imageData + "'})\"&gt;Click here&lt;/a&gt;;

&lt;a width=\"550\" height=\"190\" href=/ onclick=\"onclick=location.href=\'data:image/png;base64," + imageData + "\'\"&gt;click here&lt;/a&gt;;

&lt;img src=\"data:image/png;base64, " + imageData + "\" width=\"200\" height=\"150\"/&gt;;
</code></pre>