Hi, I am using Button web server control which responds to a onclick event .In the onclick event handler i am using the serverside javascript for opening anew window.Heres the Snippet of the code. If someone has Popupblocker on their machine the new window
doesnt showup -------------------------------------------------------------- private void butt_sales_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string strJscript = "<script language='javascript'>"; strJscript += "window.open('sales.aspx','','menubar=yes,scrollbars=yes,resizable=yes,width=640,height=500');";
strJscript += "</script" + ">"; Response.Write(strJscript); } ------------------------------------------------------------
Ask your users to add your site to the popup blocker's list of approve sites, or find a way to accomplish this without popups. Perhaps a link next to the button that says "Sales popup not working? Click to here to learn why." This could either trigger a new
page, or a javascript alert (are those blocked?) explaining the situation. Popups seem to be a losing battle, since in many user's equate popups to pure evil, and browsers such as Mozilla already have built-in popup blockers.
No, no, no - I know the true reason why you are asking. Soon as that button is not doing any other server side "work", why can't you use the onClick attribute from the client side so the blocker can see it is from a user's direct response?
Thanks Justin and Harry for your timely replies, I have some work in the serverside for the onclient event for example : setting session variables ,Finding the checked items from datagrid etc.. If i use the onclick attribute for the button and add some function
so that it can check whether the to open the new window or not depending on the checked items(opens new window if there are some checked items otherwise not) if so ,can you guys show me some code where i can call a Javascript function Tom
Sorry, I will not provide the JS because there is power crazed developers trolling around. However, I would advise you from reworking your logic... does it have to open a new window? What is so special that a new window should be displayed?
I had the same ANNOYING problem with the popup blocker for my site. So, I installed the blocker on my browser to ensure it didn't break my site after it forced me to make changes. I really don't even like the blocker from a client's perspective, as I've gone
to a few sites that prevented VITAL instructions from showing up in a popup.. I wasted a few minutes of my time before I enabled popups at certain sites. I think I will be uninstalling it from the browser shortly, popups never bothered me in the first place.
Anyways, now that I'm done complaining, I did notice a potential way to get around the blocker a few weeks after I had redone my site. The following bit of html allows a new IE window to show up ON MACHINES WITH THE POPUP BLOCKER INSTALLED:
This will create a new window without javascript (a target="_blank" seems to be the key here..) With some craftiness and a timely Response.Flush() on the server, you might be able to do something with it.
Let me know.. I'd like to try it myself. My guess is that the popup blocker will be revised to prevent this from working in the future, so you might want to consider keeping navigation thru your site all in one browser anyways. Brent
It is not a "bug" that you found. It is perfectly normal. The logic of allowing it is to navigate away from the site in a new window. Pop up blockers are there to disallow pop-ups from occuring without an user input. If a new window is opened because of user's
click on the mouse (directly, on the same page without refreshing the page), it should still happen. I have a blocker running - I just do not like the idea of an ad popping out at me and calling to get focus while I was reading some article. That is very annoying.
But there is some blockers that go to the extreme of blocking everything that comes its way... which that becomes extremely annoying not to get some functionality (instead, you must now navigate the web with a series of mouse clicks and holding down some keys).
Justin, is there a popup blocker that you like? Particularly one that's small, and unobtrusive on the system? (I hate clogging up my development machine- you should've heard me when ZoneAlarm Pro kept crashing on me with fatal errors!)
TomASPNET
Member
15 Points
3 Posts
Getting around popup blocker
Jan 05, 2004 07:32 PM|LINK
harrycaul
Member
325 Points
65 Posts
Re: Getting around popup blocker
Jan 05, 2004 08:25 PM|LINK
master4eva
Star
13635 Points
2719 Posts
Re: Getting around popup blocker
Jan 05, 2004 08:26 PM|LINK
TomASPNET
Member
15 Points
3 Posts
Re: Getting around popup blocker
Jan 05, 2004 09:38 PM|LINK
master4eva
Star
13635 Points
2719 Posts
Re: Getting around popup blocker
Jan 06, 2004 09:16 AM|LINK
TomASPNET
Member
15 Points
3 Posts
Re: Getting around popup blocker
Jan 06, 2004 02:13 PM|LINK
master4eva
Star
13635 Points
2719 Posts
Re: Getting around popup blocker
Jan 06, 2004 02:22 PM|LINK
big_jim_mcbo...
Participant
1245 Points
249 Posts
Re: Getting around popup blocker
Jan 06, 2004 09:36 PM|LINK
master4eva
Star
13635 Points
2719 Posts
Re: Getting around popup blocker
Jan 07, 2004 06:15 AM|LINK
Thomas1
Member
625 Points
125 Posts
Re: Getting around popup blocker
Jan 07, 2004 01:52 PM|LINK