Closed Bug 241338 Opened 20 years ago Closed 15 years ago

fnac.es - "ampliar imagen" (enlarge image) popup does not resize to image size (they use document.layers)

Categories

(Tech Evangelism Graveyard :: Spanish, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: durbacher, Unassigned)

References

()

Details

(Keywords: ecommerce, Whiteboard: [bug248549notfixed])

1.) Go to a http://www.fnac.es/
2.) Click on any product (image or title)
3.) Click on "ampliar imagen" (enlarge image) to open a popup with that image.

This popup will be 50x50 pixels, non-resizable (as determined in the window.open
code) and *should* resize to image size on load.

However, they use 

if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}

to sniff browsers and then for resizing they do

if (isNav4) {
window.innerWidth = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}

As bug 19390 comment #1 points out, document.layers was already deprecated in
1999! Doing:

if (isNav4) {
window.innerWidth = document.images[0].width;
window.innerHeight = document.images[0].height;
}

does work but will probably break Netscape 4. However, nowadays there are much
more Gecko (Netscape, Mozilla,...) users than Netscape 4 users, so this is
already an improvement.
A better solution would additionally sniff for e.g. "Gecko" and do the
appropriate things in its own if-clause. This would probably also help Konqueror
and Safari users, if they are also affected by this.

BTW: fnac.com (=fnac.fr) gets it right:
http://www.fnac.com/Shelf/article.asp?PRID=1524583 is an example.
They just do:

function autoSize() {
  self.resizeTo(500, Min((document.images[0].height+130), screen.height-25));
}

so this apparently works in IE and in Gecko based browsers.
Whiteboard: [bug248549notfixed]
fixed
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.