How to handle rel="async-post" dialog in TWebbrowser Delphi(Lazarus))? - ajax

I am making an app for FB to be able to ban people from my facebook page even when they have not yet commented or liked my page. Just like detailed here. I have a browser written in Lazarus, it logs onto facebook, navigates to page/settings, selects the first user on the "People who like this" list and changes the url and gives me a confirm dialog:
The below code creates this dialog:
<a class="_54nc" href="/pages/likes/label_fans/?action=remove&page_id=1234567890&user_id=1234567890" rel="async-post" role="menuitem"><span><span class="_54nh">Remove</span></span></a>
I would like to parse the popup dialog when it hits OnDocumentComplete event, but I am not able "catch" it. (I guess it is due to the fact this is made with AJAX(?) and with "async-post". )
Anyone knows why?
Thanks in advance,
modzsi

It looks like you can do it via API:
https://developers.facebook.com/docs/graph-api/reference/v2.0/app/banned
It doesn't mention any restriction to the user id's you can pass in.
I guess you'll need another API call to retrieve the list of people "Who Like This".

Related

Back button to ajax results, advice request

I am trying solve the back button issue within my app. The scenario is:
I have a home page with a search form which sends and receives data with $.ajax(), then the results loaded through ajax, their links points to a controller that won't be done by GET in ajax so that means that the page will be refreshed (so the home page with the results looks like this: http://url/en/home and a result link may look like this http://url/fetch/data/x123av).
The problem is which is the best way fix that when click back button to return the results from the search box?
I have found some answers in stackoverflow related to my question:
http://code.google.com/p/reallysimplehistory
http://tkyk.github.com/jquery-history-plugin
But from the documentation of those plugins, they all work by checking the hash change which I don't have.
Hope I have explained well enough, and I do have searched stackoverflow and google for a solution but I didn't find one that is close to this or either I've jumped over it...
Please just point me to the right way :D
But from the documentation of those plugins, they all work by checking
the hash change which I don't have.
If you want to handle the back button with AJAX request you will have to redesign your application so that it works with hashes as that's the only way. Changing the fragment portion of an url doesn't trigger a page reload but it is added to the history, so when you press the back button you are able to detect this change without navigating away from the page.
As mentioned by SLaks in the comments section another possibility is to use the HTML5 history API but obviously this assumes that the client browser supports it.

Do I need an API key to add a Facebook Like button to website?

I want to show a Like button on some product pages on a website, when a user clicks Like, I want to show the product image along with the link on their wall. Can this be done without an API key?
YOu dont need a API key to add FB like to your website, just copy the iframe code and past it into your HTML.
Check this out for your info:
http://developers.facebook.com/docs/reference/plugins/like/
You can not publish to a users wall without permission to do so. And to get this permission you need an API that the user authorizes.
Also I don't think that a user wants a wall post when simply clicking on 'like'. It will appear on his wall anyway as 'xy likes this'.
I'm a Platform Engineer, you can choose the image and text that gets displayed in the news feed when the user clicks the like button by using Open Graph tags in addition to the like button.
https://developers.facebook.com/docs/opengraph/
I hope this helps!
J

Windows Phone 7 Sign in screen redirect

Apologise if there is answer for this somewhere else, I can't find any.
I imagine this is a common situation. The first time the user runs the application I want them to be presented with the SignIn.xaml, if they don't have any saved details, else I just want to go straight to the MainPage.xaml.
I'd usually do this by sticking a check in the constructor of the MainPage and if they don't have details navigate away. The problem I have is that
NavigationService.Navigate(new Uri("/SignIn.xaml", UriKind.Relative));
is coming up as a null reference. What am I missing? Is there a proper way to do something like this in WP7?
Thanks
Unfortunately the WP7 navigation framework doesn't handle the "do something on first run" situation very nicely at all.
I suspect the problem you're seeing is that you don't have a NavigationService yet... but even if you did, you'd have a problem: the user could still hit the "back" button. You can't even work around that, because the user pressing back should exit the app... but there's no way I'm aware of for doing that without already being at the first page naturally when the user hits the back button.
The only workaround I've found for this is to have the "sign-in" view in the same page as the normal first page, and display one or the other conditionally. Yes, it sucks... but it's the only approach I've found which works. If you find another, I'll be happy to hear about it :)
Peter Torr covers page redirections quite well here. Two methods are offered with relative merits covered. Edit: Note you can redirect to a login page, rather then employing the popup suggestion for login handling.
Redirecting an initial navigation - Peter Torr's Blog
I'd also recommend familiarising with his accompanying post on places here.
Introducing the concept of “Places” - Peter Torr's Blog
This address back stack handling (certification consideration) and addresses scenarios such as login pages.
Rather than have your main page navigate to a sign in page (which will upset you back stack). Either conditionally set the first page or have the login appear as a popup.
Have a look at this question for more on the subject.
I was able to get Peter Torr's UriMapper approach to work with the separate login / welcome page. The main thing was changing the Uri of the UriMapper again after the login and then changing the query string when navigating back to MainPage.xaml after finishing with the login / welcome page. Otherwise when attempting to navigate to MainPage.xaml from the login page, nothing happened.
For more info and a sample project see http://www.geoffhudik.com/tech/2012/2/19/windows-phone-login-navigation.html. I welcome any thoughts and better suggestions.

Is there an extension or a way to write an extension for firefox that allows a developer to refresh a page, but discard POST data?

I'm a developer, and I spend much of my day refreshing the webapps I work on. Occasionally, I'll encounter pages where POST data was submitted, and firefox will prompt me to Resend POST data or to Cancel.
Now, I know that I can just redirect a page to itself to get rid of this warning, but I still want to keep this warning for our users; I just want to be able to skip it while developing. It's also not just on one page, but at many different points throughout the app, so it's not like I can just do if $debug==true then redirect or something like that.
Basically just a minor convenience issue, but when I encounter the message 50-100 times a day, it can get aggravating. What I want to do is essentially have 3 options when refreshing: Resend POST data, cancel, or refresh without resending POST data
The third option would be equivalent to clicking "enter" in the address bar (which is what I end up having to do). The problem with clicking enter is that I often have to "hard refresh" using ctrl+shift+r, but if I do this with POST data I have to click cancel, then click enter on the address bar, then do a hard refresh after that. I would instead like to press ctrl+shift+r, then continue hard refreshing the page without the POST data.
Does anyone know how to do this? Through an extension or otherwise? It's totally a minor issue, but it's something that constantly bothers me and I actually think it would be quite a useful option.
Thanks
Try to look here.
There is a script that could be useful, but i didn't try it.

facebook-ish like iframe in ajax

Can anyone here expand on how I can create a frame within a page, like facebook has (when you click on a user's profile and your not friends with him, for example) in AJAX, or even better - does anyone know a framework that would do the AJAX dirty work, with me writing in PHP?
Something like
$frame = new iframeObject;
$frame->setType('a');
and so forth?
Thanks!
Assuming that your refering to the Modal dialog boxes then check this out...
http://www.84bytes.com/2008/06/02/jquery-modal-dialog-boxes/

Resources