fbAsyncInit is not Firing - facebook

See this Page Tab (its only a test page, just fan it :-)
http://www.facebook.com/pages/Ludwig-Test/127771653944246?sk=app_165323306883725
its working in FF. But not in IE.
You should see 2 Alert boxes, one from fbAsyncInit and one from getLoginStatus. in IE neither ist coming. but now to the funny part. Press F12 to open the DeveloperTools from IE. and click on "iPad Gewinnspiel" again. now its working.
Right klick on the icon of "iPad Gewinnspiel" to open the page in a new tab. -> not working. again with F12 and it will work.
Does anyone have any idea what i could do to fix this ?
TIA

You need to initialise the FB object inside the async function
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_ID',
status : true,
cookie : true,
xfbml : true,
oauth: true
});
// Do stuff with FB object here
}

I should really not use console.log in the code when i want to test IE.....
as soon as this for IE unknown commands are out of the code is working as expected.
Funny enough when the developer console is open this function exists and are working. stupid IE developer who thought of such nonsense.
see What happened to console.log in IE8? for more information.

Related

How to hide div in in-app browser or android webview

I have asked a question in Hide div in a Custom Tab opened from a Trusted Web Activity
Let me explain a little bit more.
My twa website is https://www.monsoonmalabar.com/
In the above site there is a link to external site which is https://keralapsc.monsoonmalabar.com/ when clicking this link in twa app, this link opens in in-app browser. In that in-app browser(website: https://keralapsc.monsoonmalabar.com) there is a button floats left side with link https://play.google.com/store/apps/details?id=com.monsoonmalabar.app.
I want to hide that link(button) when user using twa(in-app browser). According to your suggestion in the stackoverflow site, I added the external link as https://keralapsc.monsoonmalabar.com/?hideDiv=true
And added a code in external site as
<script>
var url_string = window.location.href; //window.location.href
var url = new URL(url_string);
if(url.searchParams.get("hideDiv")) {
document.write('<div></div>');
} else {
document.write('<div id="play_button"><a class="btn_openinapp" data-attr="btn_openinapp" href="https://play.google.com/store/apps/details?id=com.monsoonmalabar.app" style="left: 0px;"><i class="fab fa-google-play"></i></a></div>');
}
</script>
Now what happens is during the first visit from twa(which has hideDive=true) the button disappears. But when I continue to surf external site by going to another page in that external site button shows again. Maybe I didn't understand you correctly. Can you please explain a little bit more with codes. I am new to coding. My twa app is https://play.google.com/store/apps/details?id=com.monsoonmalabar.app
Below is the screenshot of external link marked.
The solution is to save the hideDiv information into the sessionStorage, so you can load the information from there when navigating to other pages.
The code would look something like this:
<script>
// Set `hideDiv` to `true` on sessionStorage when we receive the `hideDiv` parameter.
const url = new URL(window.location.href);
if(url.searchParams.get('hideDiv')) {
sessionStorage.setItem('hideDiv', true);
}
// sessionStorage is persisted across page loads, but cleared if the tab is closed and
// a new navigation session starts. We check if it's been set to `true` in this session.
if(sessionStorage.getItem('hideDiv')) {
document.write('<div></div>');
} else {
document.write('<div id="play_button"><a class="btn_openinapp" data-attr="btn_openinapp" href="https://play.google.com/store/apps/details?id=com.monsoonmalabar.app" style="left: 0px;"><i class="fab fa-google-play"></i></a></div>');
}
</script>

NightwatchJS .windowMaximize() method not working

I am using NightwatchJS to test a web application. In the prelimary steps of my test, I am trying to utilize a method that should maximize the browser window, but it does not seem to work. The method is .windowMaximize() and can be found in the API documentation. In my test, when the browser launches, it is only about half the size of the screen. Below is an example of my code for the test. Can anyone see anything I am doing wrong? The test launches and runs, but the windowMaximize() method just doesn't work Sidenote: This is coffeescript, not javascript. It gets compiled by grunt before it's run.
module.exports = {
"Smart Control Tests": (browser) ->
browser
.windowMaximize()
.launchAs "auto_test"
.assert.title "My App"
...
.end
}
If using Chrome, try starting with the browser maximized by setting that option in the the chromeOptions section
"chromeOptions" : {
"args" : ["start-maximized"]
},

Buttons on the app don't work in an app made by Smartface App Studio

I was viewing my app on a mobile testing site and when I click on the buttons on my app they don't do what they are meant to do which is to navigate a page in the app. This is the code I used for the button:
Thanks
The show method have some parameters to work. These parameters are:
show(motionEase, transitionEffect, transitionEffectType, fade, reset, duration);
Obs: duration parameter is optional.
If you don't know what to put in these parameters, just type SMF.UI.ParameterHere. You can do this with motionEase, transitionEffect and transictionEffectType. Eg:
show(SMF.UI.MotionEase.plain, SMF.UI.TransitionEffect.downToUp, SMF.UI.TransitionEffectType.cover, false, false, 350);
By the way, you can use Smartface's API to search before asking here, you'll have faster results. :)
API: http://docs.smartface.io/

Can't upload icon for Facebook iframe app - only see a CANCEL button

I'm trying to upload an icon to a new Facebook app (iframe) but the "Upload an icon" popup window only shows a CANCEL button, there's no OK or UPLOAD, or anything.
There is a little padlock icon on the top right so it seems it's locked. Any ideas?
Can't find anything about this.
Here is what I get:
Any ideas?? Thanks.
The fix for this will be pushed soon.
If you need this urgently, you can try the work-around mentioned in the comments. It's a weird one though: after doing it, it wasn't displaying in the app settings window, but actually showed up for the tab itself.
https://developers.facebook.com/bugs/281308458596344
I was also warned (and flagged) for posting about this on stack overflow this morning, so just letting you know, this should be posted on the Facebook bug pages.
It looks like a missing script. The "Choose File" input is meant to upload the image onchange:
<input type="file" name="image_upload" onchange="DevelopersImageUploader.submitToIframe(); return false;">
however the DevelopersImageUploader object is not available as shown by the console message:
Uncaught ReferenceError: DevelopersImageUploader is not defined
(anonymous function)/apps/230113777067870/summary/:1
onchange
This is a recent problem. Not only for iFrame Tab but also for other kind off application. The uploader was working last week (2012-01-20).

Logout seems to be very buggy in Firefox and IE

In Chrome and Safari it works beautifully, right when you click on the button it logs out every time.
However with FF and IE you click it on it and it just keeps on refreshing trying to load things from facebook but never goes into the logout callback. If you do it like 20 times it will finally log you out and allow you to login again. It is not consistent at all. This was all working fine some days ago, didn't change anything but now it is busted.
No Javascript Errors. Here is my log out code.
FB.getLoginStatus(function(response)
{
alert("inResponse");
if(response.status == 'connected')
{
alert("inConnected");
FB.logout(function(response){
alert("inLogout");
window.location="./logout.php";
});
}
........
inReponse is printing, inConnected is printing, inLogout never gets successfully called... This is very frustrating, any idea what could be wrong? Thanks
Looking i'm not sure ether but i think you might be missing a few closing brackets
FB.getLoginStatus(function(response))
{
alert("inResponse");
if(response.status == 'connected')
{
alert("inConnected");
FB.logout(function(response)){
alert("inLogout");
window.location="./logout.php";
});
}
Might be helpfull