Click here to Skip to main content
Rate this: bad
good
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 = window.open("PDFContainer.aspx", '_blank');
            return (popup)?false:true;
        }
    </script>

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
Edited 10-Oct-12 17:09pm
v2
Rate this: bad
good
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?" Smile | :)
 
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.
 
—SA
  Permalink  
Comments
Abhinav S at 10-Oct-12 23:37pm
   
5!
Sergey Alexandrovich Kryukov at 11-Oct-12 0:17am
   
Thank you, Abhinav.
--SA
Rate this: bad
good
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 ?
 
http://jqueryui.com/dialog/[^]
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 11-Oct-12 0:25am
   
Good idea, a 5. It could be even the modal window (OP can find many samples).
--SA
Karthik. A at 11-Oct-12 9:03am
   
Thank you Sergey!
Rate this: bad
good
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.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 11-Oct-12 0:26am
   
Right, a 5.
--SA
Abhinav S at 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
0 OriginalGriff 6,696
1 Sergey Alexandrovich Kryukov 6,675
2 CPallini 5,315
3 George Jonsson 3,584
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web01 | 2.8.140921.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
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