Results 1 to 7 of 7

Thread: Popup Blocker

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Popup Blocker

    Hi, I'm opening new window from Code Behind for that I'm using Code :

    Dim newWin As String = ("<script language='javascript'>" + "window.open('msgstat.aspx' , 'Print', 'height=200, width=220, menubar=no, toolbar=no, scrollbars=no, resizable=no'); </script>")

    ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin)

    Now, how can I check from codebehind that Browser's Popup Blocker is enabled or Disabled and show such message.

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Popup Blocker

    In the code behind you can't, because the code in the code behind is running on the web server. However I believe it's possible using javascript on the client side. Here's a google search that might help ya: http://www.google.com/search?q=javas...ient=firefox-a
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Popup Blocker

    You can do yourself a favour by taking the popup out of the equation. Ask yourself, do you really need it? Can you not show the information in a different way?

    Gary

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: Popup Blocker

    Quote Originally Posted by gep13 View Post
    You can do yourself a favour by taking the popup out of the equation. Ask yourself, do you really need it? Can you not show the information in a different way?

    Gary
    Ya, I'm showing the tip to users to check if pop up is blocked. bt it would b better to find ourself and inform users.

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Popup Blocker

    What I meant was, do you even need the popup at all? What is in that pop up window?

    Gary

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: Popup Blocker

    Well thanx friends for ur help. I found beautiful solution .
    I Created a jacascript file like :

    function detectPopupBlocker() {
    var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars =no,status=no,titlebar=no,top=0,location=no");
    if (!myTest) {
    alert("Kindly Enable Your Popup-Blocker");
    } else {
    myTest.close();
    }
    }
    window.onload = detectPopupBlocker;

    It has solved my problem. When Page Loads It checks it.
    Thanx

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Popup Blocker

    But what happens if JavaScript is not enabled on the client?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width