Not even Opera Browser is immune to the same issue. This problem doesn't just impact IE and Chromium-based browsers, but potentially others as well. Since both Chrome and Opera originate from the Chromium browser project, they share similar vulnerabilities. Testing has shown that Firefox is the only browser that behaves correctly in this scenario.
I have previously reported this bug multiple times to the relevant developers (excluding Microsoft), yet it appears that the issue still persists despite these efforts.
An approach to tackling this issue could involve embedding another HTML/CSS page into the iframe instead of directly loading the image. By loading the image within the HTML page using the "img" tag and styling it with CSS for size adjustments, you can achieve better control over the image display. Consider wrapping the img tag in a styled div to ensure proportional scaling without distortion within the container div.
To further enhance functionality, consider implementing a zoom feature. This would entail attaching a JavaScript event to the element intended for zooming, such as the div. The event trigger could be set to "onclick", or alternatively utilize the "click" event listener method in JavaScript. Alternatively, CSS effects using the ":hover" pseudo-class can also enable zoom behavior.
The example below provides clarity on how to establish the zoom functionality:
function zoom(el)
{
var checksize = el.style.width == "100%";
if (checksize)
{
el.style.width = "";
el.style.height = "";
}
else
{
el.style.width = "100%";
el.style.height = "100%";
}
}
.h
{
float: left;
width: 400px;
height: 150px;
background-color: blue;
}
.v
{
float: left;
height: 400px;
width: 150px;
background-color: yellow;
}
img
{
height: 100%;
width: 100%;
object-fit: contain;
}
.v:hover
{
float: left;
width: 100%;
height: 100%;
background-color: blue;
}
<div class="v" onclick="zoom(this)">
<img src='http://download.4-designer.com/files/20150801/It-is-said-that-there-is-no-second-wave-of-copyright-free-image-collection-54650.jpg'/>
</div>
<di...</answer1>
<exanswer1><div class="answer" i="41537526" l="3.0" c="1483896602" m="1483913192" a="d2lsbHkgd29ua2E=" ai="6508528">
<p>Even Opera Browser is affected by the same issue. It is an issue that affects IE and Chromium derived browser (and perhaps not only). Chrome and Opera are both derived from the Chromium browser project. After testing the issue on IE, FF, Op, Ch, Firefox is the only one that behaves right.
I've sent to respective developers (but MS) a bug notice with the issue more times in the past, but as far as I can see the issue is still there unfortunately.</p>
<p>Anyway to try to solve the problem insert into the iframe another html/css page instead loading the image directly into the iframe and load the image into the html page within the html tag "img". Than style that tag with the css style sheet as you wish giving the img the size you need. Also, depending on what you need, you may evaluate to wrap the img tag into a styled div to contain img size. If properly done de css part, the img will match in size to the container div scaling proportionally, without shrinking/deforming.</p>
<p>Done that let's try now the implementation of the zoom function.
Well for this it is needed a javascript event attached to the element that you want to zoom (the div for ex.). The event would be "onclick" (or "click" if you want to use addEventListener js method. Also you can zoom even without any js using ":over" css pseudoclass (in the example is used once to compare the different behavior).</p>
<p>The following example will explicate how the whole trick works:</p>
<p><div>
<div>
<pre class="lang-js"><code>function zoom(el)
{
var checksize = el.style.width == "100%";
if (checksize)
{
el.style.width = "";
el.style.height = "";
}
else
{
el.style.width = "100%";
el.style.height = "100%";
}
}
.h
{
float: left;
width: 400px;
height: 150px;
background-color: blue;
}
.v
{
float: left;
height: 400px;
width: 150px;
background-color: yellow;
}
img
{
height: 100%;
width: 100%;
object-fit: contain;
}
.v:hover
{
float: left;
width: 100%;
height: 100%;
background-color: blue;
}
<div class="v" onclick="zoom(this)">
<img src='http://download.4-designer.com/files/20150801/It-is-said-that-there-is-no-second-wave-of-copyright-free-image-collection-54650.jpg'/>
</div>
<div class="h" onclick="zoom(this)">
<img src='http://download.4-designer.com/files/20150801/It-is-said-that-there-is-no-second-wave-of-copyright-free-image-collection-54650.jpg'/>
</div>
Also remember that the iframe is not the only html tag that allows you to show an external content (the image in this case). In fact you can use the 'img' tag itself, the 'embed' tag, the 'object' tag and even the 'div' tag or other tags that accept the background to be styled with an image. In this last case you can show an image into it by setting its 'background-image' css style property to the image you want to show into it.