Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User initiated popup sometimes blocked

Status
Not open for further replies.

rlingen

Technical User
Dec 6, 2000
41
CA
I use PHP and very simple Javascript to generate popup windows to show users more information about items in a list. Even though the popups are user generated by a click on a link with an onClick=window.open() command, sometimes those popups are blocked. In this case, the user's browser does nothing but skips to the top of the page. It only happens occasionally, but it's always the same thing -- an active popup blocker.

Once we identify the blocker and either disable it, or "allow" my website, the user is ok, but it makes the site look inefficient. In a recent case, I had a user who had been with me for months suddenly couldn't use the site because of this. He swore he had disabled his blocker, but when questioned closely about any recent changes to his system , he remembered that a technician had put a copy of AdAware on his system. When he disabled that, everything was fine. So it turned out he had a double layer of blockers. If both of us had not taken the time to troubleshoot this problem, I would have lost a customer.

Here is the simple code I use to generate links:
<A HREF="#"onClick="window.open('showitempop.php?stocknum=$sn','photoWindow',photo_popup_features);return false;\">

"showitempop.php" is my script that arranges the contents of the window. The list is generated by a database that returns the Stock numbers. This is the reason I want to use popups in the first place. Once the list is generated by a search request to the database, I don't want to disturb it in its window. I want the detailed information to appear, then when the user closes the window, he can go to the next item on the list without repeating the search.

Is there something I am missing WRT the operation of popup blockers? I don't realy want to get into really fancy coding to avoid blockers for the few times this materializes. The real problem is that I don't know how much business I am missing because people visit and simply think "the site doesn't work".

If anybody wants to see the site, it's:

Thanks for your time in considering my problem.

Roy
 
If you don't find a solution to this problem, you could consider using a "floating" iframe to contain the data. Since an iframe contains a complete page, it can be used pretty much just like a new window. Instead of closing and reopening it, you just set it's display attribute to block or none, and you reload it by simply setting it's src attribute.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
You might try using

target="_Top"

in the <a href instead of opening the new window with Javascript. That wouldn't let you set the features in the new window, but might avoid the popup blocker problems you're running into. You already have the page set to come to the front when it loads, which is good planning.

Lee
 
Thanks for the ideas guys, but I don't think either of those solutions will work.

As I understand iFrames (I haven't use frames for 4 years and have never used iFrames), I would have to set aside the screen real-estate for it and I don't have the space for that. In the documentation, I did not recognize an attribute that would display it then make it go completely away. Even if that worked, the underlying screen would have to be redrawn as well every time it was made to appear. No?

As far as a target=_Top, that would open a second page, equal with the first. While I suppose I could use Javascript to give that page focus when it opens, I do not know of a way to return focus to the original calling page when it closes (the original page will have been created by a form POST command, with variables used to create the page with output from a database). Before going to popups, I used to do exactly this. I found that if focus was not returned to the original page, people would think it had disappeared. It's amazing how many people don't know to look for a previous window in their bottom bar. That caused me more problems than the current pop-up blockers problem.

I thought blockers were supposed to allow user clicked popup links. Is there some bit of code I am missing, or are some popup blockers just too aggressive?
 
An iframe (i.e. inline frame) can be imbedded within another page. It can also, with a little use of javascript and some style attributes, be made to "float" over top of your page, and you can make it appear and disappear at will (did you notice my mention of setting the display attribute to block or none? If you don't know about the display attribute, you must not have a great deal of experience with dynamic pages, since it's used to make all types of page elements appear and disappear.

As for having to redraw the screen when you make it disappear - I don't think so. I suspect all the browsers manage to make that work quite efficiently without having to recreate whatever part of the page was covered. Of course your monitor will have to redisplay it, but it's doing that at least 60 times a second anyway.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top