When a user which is not logged in to Facebook or Twitter, clicks the like/tweet button, a popup comes up asking the user to log in. This popup is not blocked by popup blockers of any kind. in IE for example, it opens up but anyway IE state a warning to the user. The bottom line is that all buttons probably use the same method.
I have a button that people click on it and it should open a similar screen, but it always gets blocked.
The button (in JS) works pretty much like FB like button. It checks if the user is logged in. If he does, then send the "like" to the servers. If he does not, then the login popup appears (and gets blocked).
So, it is a initiated by a user although not fully direct outcome, since we need to check if he logged in or not.
What is best method to do that?
The Popup Is activated by a click using the like, tweet button and they actually show only 1 popup. If you want, you can try by using only a single popup based on click for your website and you will definitely be able to understand this.
Related
I want to make popup which freezes the browser until the popup is closed. But I am stuck at a point since on closing the browser, it is asking the user to stay or leave but when a user clicks on leave it shuts down. I instead want a that when a user clicks the leave option it either reload the site or do nothing, also on doing the same for second time Chrome is giving alert to prevent any additional dialogue which I want to disable or it should do nothing. Until the popup is closed. So at last users should not be able to close their browser from a closing button of browser or by going back or replacing the URL. It should freeze until the requirement of the popup is fulfilled. Thank you and please help.
You can't force the users to stay on your site as the browser doesn't allow this (think of a malicious site forcing you to stay there). Your approach is probably the best you can do. Show a dialog that says something like. "Please wait while exiting..." or similar.
If you want to hide the "Block additional dialogs from this page" thing you can create your own dialog. Just a div with position: fixed and display: none and then onBeforeUnload show it with display: block.
Here is more on that: Stackoverflow.com
In that case you can use bootstrap popup:
like this:
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_modal&stacked=h
and on the click event on close button you can add new alert or some other popup..
and closing this type of popup box cannot reflect other data..
It might helps you.!
I want to have a message displayed automatically, whenever my pageaction icon is displayed.
How can I make that to be displayed, I want to alert the user that " You can click this button to perform so on....".
If you want a popup appear programmatically, this cannot be done, it can only be initiated by a user click.
It would be nice if you could use infobars API, but it is still experimental.
Therefore, your only choice seems to be to inject a script into the page that would create some sort of overlay on the page roughly pointing to the page action area.
Note that you will need permission to access that page, as activeTab permission is not enabled until user clicks on your page action.
I want to show a popup when a user close the browser and that popup will redirect to some google survey that we need to do.
Currently by using onbeforeunload function in JavaScript it's prompting me the popup but I only need popup when the user closes the browser or they enter a new url.
Is there any way to prevent this function to not fire when page is refreshed, or user goes back or forward and if it can be done then how will I redirect to a survey page. Or if we can't prevent then there is any logic to do this.
No, this is not possible. These events are outside your control for security reasons.
You're probably best off finding a different solution for your problem.
I would like to have my web app be abple to pop open new windows like GMail does for chats and phone calls but I'd also like to be able to detect if they click on something in the nav that will take the main window to another URL and break the code running in the popups windows.
Ideally it would prompt them and give them a chance to cancel the page change and not break the app. Any ideas how GMail does this?
You want to use the onbeforeunload event. The string you return will be displayed to the user in a dialog, giving the user the option of canceling the page navigation.
Facebook Connect has a recent bug that is causing the permissions pop-up window to not close and refresh the parent window as it is designed to do. Instead, after approval by the user it attempts to load the page directly in the pop-up window which is an awful user experience and really hurting our registrations. You can see the bug by registering for our site using Facebook Connect: http://alltrails.com
The URL of the page after the user connects that Facebook Connect is incorrectly loading in the permissions pop-up window is of the form:
http://alltrails.com/?installed=1&session={"session_key":"2.Gu0duOqdElNjXRac5wnetw__.3600.1283799600-1486832834","uid":1486832834,"expires":1283799600,"secret":"tKFaEgBTF9RJeuQZfYUSCw__","base_domain":"alltrails.com","sig":"a8dd9f75418b530ae6c3d935e14274c4"}
I'm hoping that someone much better at JavaScript than myself could suggest a simple code snippet that we could add to our homepage that would only be invoked if the page URL includes '?installed=1' and would do the following to allow the same user experience as Facebook Connect was intended to provide:
Close the permissions pop-up window
Load the appropriate page http://alltrails.com/register/facebook in the original parent window
I've tried to do this a bunch of different ways but haven't had any luck with getting it to work correctly. Thanks in advance for your help!
It's a (unconfirmed) bug.
http://bugs.developers.facebook.net/show_bug.cgi?id=12260
Hopefully it gets more votes so it gets fixed - vote people!
In the meantime, i am (attempting) to employ the following 'creative workaround':
Add logic to my Default.aspx page to detect that URL they are redirecting to in the popup.
Redirect to my page, FacebookInboundAuthorization.aspx, preserving querystring.
On load of that page, register some JavaScript to close the popup and manually fire the "onlogin" event handler for my button.
EDIT - Another possible solution
So i do something like this for the "Disconnect from Facebook" button, which has a similar bug which has been in FBC from day 1. If the user is already logged in, and you click the "Disconnect from Facebook" button, the "onlogin" handler is not fired.
So what i ended up doing is replacing the Facebook Disconnect button with my own regular anchor tag, mimicing the Facebook CSS. This way i can have full control over the click event (fire the function i want).
So, this principle could (theoretically) be applied to this current bug.
That is, after you do FB.Init on client-side:
Check FB auth status using FB.Connect.ifUserConnected
If user is connected, hide the regular FB:Login button, and show your "fake" FB Login button. Copy across the "onlogin" function from your regular FB:Login button to your fake button as the onclick event.
Your Fake FB Login button would be a regular anchor tag, with the same CSS applied to the regular FB Login buton.
So essentially, if the user is already connected, we don't really need FB's intervention for authentication, we can just do whatever we want (request perms, redirect, etc).
That should work.
Unfortunately i have higher priority things i need to work on, but it sounds like this is top priority for you.
So give that a go, hope it helps.