By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,805 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,805 IT Pros & Developers. It's quick & easy.

open popup ( window.open ) without getting security message

100+
P: 258
I have a page which opens a little popup to show recieved messages but when ever the page tries to open the popup the user should click on the yellow message on top of internet explorer and click on ( allow popup ) otherwise the popup will not be showed
Is there any way to open this window without getting permission?


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" >
  2. window.open('mypage.php','pagename','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0, width=500, height=360, left=200, top=200 ');
  3. </script>
  4.  
Sep 24 '07 #1
Share this Question
Share on Google+
12 Replies


pbmods
Expert 5K+
P: 5,821
Heya, bnashenas.

The only way to do that is to open the window when the User clicks on a link.

If you could bypass the security message, then pop-up ads could do it, too, which would defeat the whole purpose of the pop-up blocker.
Sep 24 '07 #2

100+
P: 258
thanks for the reply..
Your right... so i better use another way to notice my users
Sep 24 '07 #3

pbmods
Expert 5K+
P: 5,821
Heya, bnashenas.

What is the purpose of your popup window? Is it an exit survey?
Sep 25 '07 #4

100+
P: 258
Actualy I'm making a website for students... I also made a chat room for people to write to each other directly.. Each time someone recieves a private message a window should come up and show the message... Actualy its working fine now but the person should allow the popup to see the message which is not so normal for a website like this... and many people don't trust popups..

Anyway... as you said its hard or maybe impossible to find a way thru IE popup alerts
Sep 25 '07 #5

pbmods
Expert 5K+
P: 5,821
Heya, bnashenas.

Consider instead of opening a pop-up window right away, create a highly-visible link on the page somewhere that advertises that they have a new message.

When the User clicks the link, he is giving you 'permission', if you will, to open the pop-up.
Sep 25 '07 #6

100+
P: 258
Yes your right about that... I'v been thinking about something like a link
But in order to do this the page must be refreshed which is not so nice to refresh the window every 5 seconds... I'v made an invisible IFRAMe which refreshes every 5 seconds and gets new messages... and when there is a new message something like a popup should come up
Sep 25 '07 #7

pbmods
Expert 5K+
P: 5,821
Heya, bnashenas.

Create a hidden div that is absolutely positioned, and when a new message is available, set the div's display style property to '' instead of 'none'.
Sep 25 '07 #8

100+
P: 258
It's a great idea... but the problem is that the person can recieve messages from more than 1 person... then we need to open more than one popup... and we also have to change the text of the link...
Sep 25 '07 #9

ganesanji
P: 16
hi bnashenas,

I am also developing a chat app like u. How u used the Iframe for refreshment and to popup the window. Plz Help me. I am struggling in this. If u suggest ,it would be a great help for me....
thanks a lot in advance...
Dec 2 '08 #10

acoder
Expert Mod 15k+
P: 16,027
Post your code, so we can assist you.
Dec 2 '08 #11

ganesanji
P: 16
hi,

thanks for ur reply. I have given my code below...

this is a part of my profile.php page...
Expand|Select|Wrap|Line Numbers
  1. <span id="openPMbox">
  2. <?
  3.     $sql1 = "SELECT * FROM `chat_messages` WHERE touserID='".$_SESSION['userID']."' AND status='0'";
  4.                 $query1 = mysql_query($sql1)or die(mysql_error());
  5.                 while ($res1 = mysql_fetch_array($query1)) {            
  6.  
  7.                 echo "<script language='javascript'>openChat(\"Messenger/convo.php?sessionID=".$res1['sessionID']."\", \"Convo\");</script>";
  8.                 }
  9. ?>
  10. </span>
  11. <div id="buddy">
  12. </div>
In this file I used the DIV tag "buddy" to display the online friends using ajax.

When ever friends coming online I can see the online friends and if I click on his name , it will open a chat window. If I send any message, it sets the status of the message as "0" to the target user.

In the target user (friend) side, I need to open the chat window to display the message by executing the above query for every 3 seconds.
This is what my problem exactly, i need to open chat popup window automatically by executing MySQL for every 3 or 4 seconds.

I am struggling here for 3 day. If u have any suggestions or any alternative way to do this plz tell me. It will be great help for me....plz guide me....

thanks a lot in advance....
Dec 3 '08 #12

acoder
Expert Mod 15k+
P: 16,027
To do anything every 3/4 seconds, use a setInterval(). However, it wouldn't be a good idea to open a popup window every few seconds. What you can do is use DHTML to create a pseudo-popup within the same window or reuse an existing window.

PS. please use [code] tags when posting code. Thanks.
Dec 3 '08 #13

Post your reply

Sign in to post your reply or Sign up for a free account.