views:

2984

answers:

3

I need to make a pop-up window for users to log-in to my website from other websites.

I need to use a pop-up window to show the user the address bar so that they know it is a secure login, and not a spoof. For example, if I used a floating iframe, websites could spoof my login window and record the user's login information.

Thanks

Additional details: My pop-up will come from javascript code from within an iframe in any domain. I know this sounds like I'm creating adverts.. but really I'm not. If it makes any difference, the iframe domain and the pop-up domain are the same.

1 more detail, I'm looking to do the same thing "Facebook Connect" does... if you aren't logged into facebook, they allow you to login to facebook from any domain by showing a pop-up on that domain's site. For an example, go to any article at techcrunch.com and use Facebook Connect to comment. Make sure you're logged out of facebook and you'll see what I'm talking about.

A: 

If your users are using IE, and your site is in the trusted sites, the popup blocker will be deactivated.

Does that help?

Jon DellOro
Unfortunately no.
Sam
+3  A: 

Take a look at this site.

Some code copied from it:

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
    newwindow=window.open(url,'name','height=200,width=150');  
    if(!newindow){
        alert('We have detected that you are using popup blocking software...');}
    if (window.focus) {newwindow.focus()}
    return false;
}

// -->
</script>

And you link to it with:

<a href="popupex.html" onclick="return popitup('popupex.html')">Link to popup</a>
Sean
Looks like this does the trick. Know if this will be blocked? Or am I OK since the iframe domain and domain of the pop-up are the same...
Sam
Well one possible problem I noticed when I was looking at the examples is that it opened in a new tab instead of a new window because I have Firefox set to force new windows to open as new tabs. However, Firefox's popup blocker didn't do anything about it. The only way to know for sure is to test.
Sean
I have the same option checked in FF2 and it does pop-ups. Could you test the pop-up here: http://www.somethingtoputhere.com/therunaround/ (facebook connect demo site) by clicking on the "connect" button?
Sam
@Sam It popups up in a new tab fine, but then it shrinks my browser. I'm guessing that you're probably trying to shrink the window to fit, but since it opened in a new tab, it proceeded to shrink my entire browser.
Sean
+1  A: 

Sean example is good, but you can still detect if the pop up has been blocked in the following way:

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if(!newwindow){
 alert('We have detected that you are using popup blocking software...');}

if (window.focus) {newwindow.focus()}
return false;
}

// -->
</script>
netadictos
Thanks for the suggestion. I edited my example to include it.
Sean