Click here to Skip to main content
Sign Up to vote bad
good
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


3 solutions

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 - 10-Oct-12 23:37pm
5!
Sergey Alexandrovich Kryukov - 11-Oct-12 0:17am
Thank you, Abhinav. --SA
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 - 11-Oct-12 0:25am
Good idea, a 5. It could be even the modal window (OP can find many samples). --SA
Karthik. A - 11-Oct-12 9:03am
Thank you Sergey!
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 - 11-Oct-12 0:26am
Right, a 5. --SA
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
Your Filters
Interested
Ignored
     
0 Christian Graus 373
1 OriginalGriff 326
2 Prasad_Kulkarni 314
3 Ron Beyer 286
4 Prasad Khandekar 225
0 Sergey Alexandrovich Kryukov 7,061
1 Prasad_Kulkarni 3,830
2 OriginalGriff 3,620
3 _Amy 3,370
4 CPallini 3,074


Advertise | Privacy | Mobile
Web01 | 2.6.130619.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid