PDA

View Full Version : Coding around Safari's popup blocker




Nermal
Oct 12, 2005, 04:32 PM
I have a web app where users can upload listings, and I'm popping up a message asking whether they want to add photos.

function askAddPhotos(id)
{
addPhotos = confirm('Add photos now?');
if(addPhotos == true) { showPhotos(id); }
}

function showPhotos(id)
{
photoviewer = open("PhotoViewer.aspx?ID=" + id, "PhotoWindow", "width=615 etc");
}

This works in IE (with the popup blocker enabled), but Safari's blocker catches it and prevents the popup from opening. Is there a way to "code around" this problem? Or should I be taking a different approach?

By the way, I'm quite new at JS, so be sure to spell everything out :o

Thanks :)



Rower_CPU
Oct 12, 2005, 11:48 PM
Have you thought of maybe using a hidden <div> instead that you can pop over the content if need be? As a usability issue, what you describe sounds more like an optional task so forcing the user to click through a pop-up may not be the best approach.

Can you get away with just alerting them with a static link/graphic/button that it's an option?

Nermal
Oct 12, 2005, 11:55 PM
Oops, I meant to reply to this thread and say that I'd sorted it out. I ended up doing exactly what you suggested, I used a <div> :)

Rower_CPU
Oct 12, 2005, 11:56 PM
Great minds think alike. :)

Nermal
Oct 12, 2005, 11:59 PM
Heh, yeah, I didn't really like having the "forced" JavaScript box - it was a "quick fix". Good to get rid of it :)