Click here to Skip to main content
12,896,108 members (53,037 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET Javascript
Hello All,
I am using the following code to open a new page in java script but web browsers are giving the warning of pop-up blocker

<script language="javascript" type="text/javascript">
        function showPDF() {
            var popUp ="PDFContainer.aspx", '_blank');
            return (popup)?false:true;

How to open a page in new window if pop up blocker warning is there(not to allow manually popup blocker)
Posted 10-Oct-12 16:59pm
Updated 10-Oct-12 17:09pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is a question of the type: "Doing X is not allowed. How to do X?" :-)

If a popup blocker allowed you to do a popup, it would be a very bad blocker, and people would not use it.

Please understand that a popup blocker is always a step ahead of you: it uses interface to a concrete Web browser which in turn take a total control of all rendering and scripting on the client side. And your application is supposed to work with all kinds of HTTP client software and be somewhat abstracted from it. From this point, it's easy to understand that it's much easier for a blocker to block your code then break this blocking.

Abhinav S 10-Oct-12 23:37pm
Thank you, Abhinav.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I second what Sergey said. That's the whole point of having a popup blocker! Why not just open something like a jquery ui dialog ?[^]
Good idea, a 5. It could be even the modal window (OP can find many samples).
Karthik. A 11-Oct-12 9:03am
Thank you Sergey!
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

The answer is as simple as "no you cant".

Imagine you turn on a popup blocker on your browser and some malicious users is still able to open a popup when you are browsing a site - beats the whole idea of a popup blocker, doesn't it.
Right, a 5.
Abhinav S 11-Oct-12 12:37pm
Thank you SA.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100