Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    dr1
    dr1 is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    window.open Help!

    Hi I'm new here and need some help;

    I spent so long with this and need either a miracle or a javascript expert!

    I have the code below which is used to open up a chat window, the problem is all browser treat this as a pop up and block it!

    What could be changed to get round this?

    $chat = "window.open( '" . SK_Navigation::href("private_chat", array("userKey"=>$pr_key, "oppUserKey"=>$opp_key, 'is_esd_session'=>1 )) . "', '', 'height=540,width=415,left=100,top=100,scrollbars=no,resizable=no' );";

    Thanks
    dr

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,985
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    As you say, all modern browsers will block unrequested popups.

    You could do something like

    Code:
    <div id='chatArea' style='border:1px solid #aaa; width:500px; height:400px; overflow:auto;'></div>
    but I do not know how you would get it to display in accordance with your code.

    It is your responsibility to die() if necessary….. - PHP Manual
    Last edited by Philip M; 02-25-2012 at 05:29 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    dr1
    dr1 is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    As you say, all modern browsers will block unrequested popups.

    You could do something like

    Code:
    <div id='chatArea' style='border:1px solid #aaa; width:500px; height:400px; overflow:auto;'></div>
    but I do not know how you would get it to display in accordance with your code.

    It is your responsibility to die() if necessary….. - PHP Manual
    Not sure I understand how? I know what a div is, and besides this really needs to open in a new page or tab, separate to the main page. any thoughts.....?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,985
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Quote Originally Posted by dr1 View Post
    Not sure I understand how? I know what a div is, and besides this really needs to open in a new page or tab, separate to the main page. any thoughts.....?
    It is for the user to decide whether to open a new window or a new tab. You cannot control it.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    dr1
    dr1 is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    It is for the user to decide whether to open a new window or a new tab. You cannot control it.
    Yeah sure, but there's got to be away to get around the pop up window been block after all the user is requesting it. (By clicking on a button)

    This code below manages to open without been blocked, so why not mine?

    <a href="Http://www.yahoo.com" onclick="MyWindow=window.open('http://www.yahoo.com','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no, resizable=no,width=600,height=300'); return false;">Click Here</a>

    Someone suggested doing it via html and passing the variables that way... any ideas if that would work/ how to?

    Thanks

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,985
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Quote Originally Posted by dr1 View Post
    This code below manages to open without been blocked, so why not mine?
    Because your popup is unrequested. The user must deliberately click on the link (that is request) the Yahoo page.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    dr1 (02-25-2012)

  • #7
    dr1
    dr1 is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Because your popup is unrequested. The user must deliberately click on the link (that is request) the Yahoo page.
    No, it's been requested by the user clicking on a button or should be, so how would I change the original code to make it work if user requested?


  •  

    Posting Permissions

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