I'm developing a Facebook application.
It can be seen here:
http://apps.facebook.com/tangram-girbaud/
When the user has to aprove the application, this comes to the screen:
A Facebook logo inside the canvas, and the user does not click the logo.
If you click that logo Facebook sends you to the aproval window.
Is there any way to override this view?
Thanks.
What you need to do is to redirect using the below script:
<script type="text/javascript">
window.top.location.href = "https://www.facebook.com/dialog/permissions.request?app_id=196403870434233&display=page&next=http%3A%2F%2Fwww.pilatosapp.com%2Ftangram-girbaud%2F&response_type=code&fbconnect=1&perms=publish_stream%2Cuser_about_me%2Cuser_birthday";
</script>
from frame info, address of frame is:
https://www.facebook.com/dialog/permissions.request?app_id=196403870434233&display=page&next=http%3A%2F%2Fwww.pilatosapp.com%2Ftangram-girbaud%2F&response_type=code&fbconnect=1&perms=publish_stream%2Cuser_about_me%2Cuser_birthday
As you somehow frame facebook.com, it doesn't show the content instead facebook logo.
you may inspect further why permission dialog opens not at window.top
Related
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>
I have a native iPhone app, which has a UIWebView component to it. I am trying to see if I can replicate the "Add to Home Screen" button that is present in the tab bar options in Safari.
Is this possible inside a UIWebView within a native app?
Thanks!
Brett
[I presume your question is about replicating the action associated with add to home screen, rather than replicating the appearance of the button itself (which being pedantic is what you actually wrote).]
As others have said this isn't possible.
What you could do is programatically launch Safari from within your app and give it the URL of a page to load which is your page.
When your page is loaded it has some sort of animation and shows the user where the add to home screen button is and tell them to press it after clicking a link which is displayed in your web page. When the users click on the link it takes them to whatever page it is that you would like saved to the desktop, and you hope they follow your instructions.
If you register your app to handle a proprietary url scheme the users can get back to your app from within Safari by clicking on a link using your app's url scheme.
The web pages that you seed Safari with must however be remote pages, you cannot give Safari a page in your app's bundle or that your app has downloaded as Safari cannot read pages from your app's sandbox.
The short answer is no, you can't. Apple does not let you.
Here's a similar question which may help you come up with other possibilities:
Javascript for "Add to Home Screen" on iPhone?
If I had to think of a work around off the top of my head, you could create an javascript pop-up which instructs them how to. It could say something like tap this button to go to mobile safari then tap action -> add to home screen.
Execute the Javascript with UIWebView's method:
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
Hope this helps.
You can use UIActivityViewController with your url as the activity items
NSArray *activityItems = #[title, url];
And then you can exclude the activities that you don't want. I think it´s the only way for now.
We are using the following code to generate a Facebook app request dialog in our Facebook canvas app.
var options = {
method : 'apprequests',
message : 'MESSAGE',
title : 'TITLE'};
FB.ui(options, function() {alert("called back");});
When we make this call in mobile Safari on an iPad, the height of the app request dialog extends well beyond the height of the canvas, so that the user scrolls down to see a very long dialog on top of a blank background toward the bottom of the page.
Please note that this does not occur in the Facebook iPad app itself, only when accessing facebook.com through mobile Safari.
I've tried calling FB.ui with the 'touch' option - doesn't help.
I've tried calling FB.ui with the 'iframe' option and an access_token - I get a 191 error which I haven't been able to figure out how to fix.
I've made various attempts to set styles for the DOM elements that I can see make up the app request, but this isn't working.
I've tried to use
FB.Canvas.setSize($('body').height())
to force the size of the canvas in the hopes that the overlaid dialog would respect it, but no such luck.
The other approach I've considered is attempting to manipulate some of these DOM elements in the app request dialog, but this is not looking promising.
Height setting on this canvas app. is "Settable". Changing it to "Fluid" doesn't help.
Any help is appreciated.
Wes
Update - 12/19/11: The following bug is now being worked on by Facebook: https://developers.facebook.com/bugs/255079837889099
I'm running into this simple issue but not able to find any docs for this.
I was using the following facebook login button which was displaying a long/large facebook login button and this works perfectly fine
<fb:login-button length="long" size="large" perms="publish_stream,offline_access,email,user_events,rsvp_event,user_about_me,user_location,user_website,sms"></fb:login-button>
Now I wanted to use the social plugin and show the faces - so I saw the sample code here - http://developers.facebook.com/docs/reference/plugins/login
<fb:login-button show-faces="true">
But I'm not able to specify the attributes length and size here - even if I do add - the size does not change
<fb:login-button show-faces="true" length="long" size="large"></fb:login-button>
Any ideas on how to increase the size of the button.
Thanks
You cannot change the size of the button when using show-faces="true" at this time.
Special thanks in advance for sending me answer........
I m the beginner in iphone development. I was calling html page in the UISegment Controller.The url in that page html page is open in the same page. In html page i wrote the following code
www.google.com
But it open that url in UISegment Control of WebView on same page. I want that url open in new page of safari browser in iphone.
You can assign a delegate to your web view.
In the delegate's class, implement -webView:shouldStartLoadWithRequest:navigationType:. Then use UIApplication's -openURL: to close the app and open the page in MobileSafari.
google in a new window