Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
hi guys ,
how to always allow the pop-up blocker in page load ,

When i call the function in page load it is blocking by the browser, How to allow directly from coding , the window should fire on page load only ..

with out blocking, how to open new window in page load please help me frnds how to do

JavaScript
<script type="text/javascript">
        function OpenPopup() {

            window.open("ProductClass.aspx", "List", "toolbar=no, location=no,status=yes,menubar=no,scrollbars=yes,resizable=no, width=900,height=500,left=430,top=100");
            return false;
        }
</script>
when i call this in code behind browser is blocking please tell me how to do ..

thanks and regards
mani.
Posted

It sounds absurd, sorry. If some browser's blocker could be circumvented by writing different JavaScript code, who would ever bothered to install such browser? If it blocks, it blocks. The browser always plays the active role and has full control over its behavior, and the server only provides some content in response to HTTP request and cannot control the behavior of the client. If it was possible, who would trust Internet safety?

So, the real solution is: don't use popup windows. They are inconvenient, intrusive and are often blocked. There are much better alternatives: simulation of modal behavior inside a single Web page.

First of all, this is jQuery Dialog: https://jqueryui.com/dialog[^].

There are many 3rd-party jQuery plug-ins collectively known as "modal pop-ups". They feature different impressive visual effects, such as transitions and, notably, the window dimming. Please see: http://bfy.tw/AJH[^].

Good luck.
—SA
 
Share this answer
 
You cannot. This is a browser feature, which if you could disable it via JavaScript, every site would be doing it.

At best you can test if it’s enabled or disabled with something like the following in your applications code:

JavaScript
winpop = window.open("asdf.html");
if(!winpop || winpop.closed)alert("Popups are required");


You could also look at changing the browser settings / trusted sites to allow the popups from this single domain/site.

Other options which I have not explored, is adding the site to trusted sites zone / allowing popups from the site via Group Policy (if in a domain / corporate environment), much the same as above, just controlled via group policy.


There may be other ways but an on-code solution is not possible AFAIK.

-DB
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900