On my Flex/Actionscript app I'm using FB.login, which started giving me a blank popup after inserting credentials. On IE it still works, but from what I read, this is the cause:
Calling FB.login results in the JS SDK attempting to open a popup
window. As such, this method should only be called after a user click
event, otherwise the popup window will be blocked by most browsers.
I was thinking to show a Javascript popup and after user clicks on it execute FB.login and send data back to Actionsript. Will this work?
On Actionscript I'm simply executing:
Facebook.login(onLoginHandler,{perms:'friends_work_history'});
Now, how can I call JS and then get login data back on Actionscript?
If the blocker was the culprit, I think you wouldn't see the popup at all.
What's the structure of the code that gets the login status and then calls FB.login?
I had a similar problem. Turned out to be code in/around the FB.login callback that was causing the problem.
This is a good example of something (javascript) that works: http://developers.facebook.com/blog/post/2012/05/08/how-to--improve-the-experience-for-returning-users/
Related
I am trying to add a onbeforeunload to my code so it fires a message that is sent to a server. I am encountering the following issue:
On page refresh, the message is sent to the server when using Firefox. It does not send a message to the server when I refresh the page on Google Chrome.
When clicking on links on my site to navigate to different sites, the server gets a message only when using Chrome. Firefox does not send a message when clicking on external links.
I also know that onbeforeunload is supposed to work when the window is closed, you enter a different website and navigate to that. There are some additional cases which also trigger the function. My site does not work with any of these along with the errors mentioned above.
If there a fix to this? If so, what can I do? I have looked around to fixes but I only get fixes where it prompts the user on whether they want to leave the page or not, I do not want that.
Additionally, I tried adding the function call to onclick on my external links but that is not being triggered on Firefox. I am guessing this is due to the amount of time onbeforeunload has before it is cancelled. If so, there a way around this?
Lastly, if this is not possible with onbeforeunload, what are my other options without prompting the user if they want to leave or not.
Thanks in advance!
EDIT: Here is some code that can be used:
https://jsfiddle.net/985drboy/
Make sure, that your code sending the message to the server is blocking and not async. If onbeforeunload returns before your message is sent, you get undefined behavior e.g. your message might not be sent if the page is unloads before the sending was complete. The browser continues unloading as soon as unbeforeunload returns.
We are launching a Browser from our Python back-end code. This opens a 3rd party's URL , where the user needs to submit a form. After submitting the form , the browser instance should close automatically. We tried from Python's side but it is not possible to manage the state from back-end.
Can we write some Javascript wrapper at front end to handle this?
You can't.
Javascript can't close the browser from inside or it will be tricky
Unfortunatly, if you don't have access to the 3rd party js code or an API informing you that request has been submitted, you can't even know when the user has submitted the request.
Switching on window.close(), if your application is opening only one window, you can use the:
window.close()
method. This method will close the current window. So, if you have only one opened window with Chrome (for example), the browser will be closed.
If you have multiple windows opened, only the window where the function is executed will be closed.
I am using the latest version of selenium web driver and google chrome browser.
In my app, after clicking on login button while dom is getting loaded I get a popup
image
I just want to close this popup without entering any value. I am using java for scripting.
I tried javascript executor, all popup handlers from selenium but not able to close the same. I am not able to shift control on the popup window.
I google a lot but didn't found any relevant code
This is a default behavior when using HTTP basic authentication. To stop this window to come you would need to send user and password in the request. Or as I understand from other response I found about this you can write:
driver.get("http://UserName:Password#Example.com");
There seems to be a similar issue, going on in thread: How to handle authentication popup with Selenium WebDriver using Java
If all you want to do is "Cancel" the popup, instead of entering credentials. You may be able to just use this.
driver.switchTo().alert().dismiss();
using AutoID was able to resolve above issue.
Refernce: http://learn-automation.com/handle-windows-authentication-using-selenium-webdriver/
I am using Django v1.10 for an application where in need to send an API call just before browser close through crude javascript (don't want to use any library for sake) preferably. I've read about window.unload and window.onbeforeunload. The first one didn't seem to work at all. The second can work but it also gets executed when there is reload or redirection to another page (it works as it should but that is what I don't want). I've tried using SESSION_EXPIRE_AT_BROWSER_CLOSE of Django which works only when a user has totally exit out of the browser (no browser process running). I've also seen answers on the web where people have suggested to open another window/tab of the browser through JS as the tab closes.
So in precise words, I want to make an API call just before browser tab close (not in any other situation).
Please help!
I have a SWF file that calls some javascript which shows the facebook login dialog via the javascript sdk.
this all works fine, except for that fact that pop-up blockers block the login dialog, as it isnt invoked from a user action, but from flash.
any idea on how i could get around this?
You can try this script....
http://snipplr.com/view/29544/
...but I doubt it will help much.
Or, What you could do is float a regular HTML button on top of your flash element so that it looks like it's part of the flash file and invoke the login procedure the old-fashioned way. This button could also be displayed/hidden/animated from flash to further integrate it into the user experience.