Photo Corners

A   S C R A P B O O K   O F   S O L U T I O N S   F O R   T H E   P H O T O G R A P H E R

Enhancing the enjoyment of taking pictures with news that matters, features that entertain and images that delight. Published frequently.

Site Tweak: One You Won't Notice Share This on LinkedIn   Share This on Google   Tweet This   Forward This

10 April 2015

You shouldn't notice the solution we implemented last night but you may not even have noticed the problem. We, however, did. And we were puzzled.

Why, we've been wondering, have all our popup windows been short?

We calculate a nice buffer around the height and width of any popup image and pass that along to the JavaScript code that creates the window. But for a while now, there was no buffer at the bottom.

To diagnose the issue, we opened an old version of the Safari browser on a PowerPC laptop and called a sample page. No problem.

Why, we've been wondering, have all our popup windows been short?

So this was something the current version of Safari (and other browsers, it turns out) was doing.

We could tell by looking what it was doing. It was drawing a location bar in the window. The location bar reports where the window comes from.

Except wanting only the image, we had used Javascript to turn off the location bar, the menu bar, the tool bar, scroll bars and all night bars. We just wanted to display the enlarged screenshot or photo.

Modern browsers override those instructions to discourage spammers from using popups.

Our first impulse was just to use Lytebox, which handles our slide shows, for single image display. But when we tried it, we remembered why we used popups. Sometimes we want to leave the window open to compare the image with other images in the story, as in our feature on Aging A Photo With Exposure 6.

So back to the JavaScript, which we isolated in yet another JavaScript file so we can refine it as circumstances require. We'll spare you the details, but the trick was to identify various browsers (they all draw the location bar differently, of course) and set various values for them.

We tested this on Intel and PPC versions of Safari, Firefox and Chrome and it looks right to us (after updating all the stories to use the new code). But if we missed your browser, just let us know with the feedback button. A good test would be last night's Bakers Beach Sunset story.

BackBack to Photo Corners