Invoke a website button from iOS app - ios

Will I able to invoke a button action ( HTTP Post/Get) through swift? I searched few posts and I am able to retrieve the contents from a web page. But I am not able to post anything. Say, web page has a login screen and the user needs to enter user name and password and click submit. How do I do this? note: The website I am using doesnt use URL parameters
Any help is highly appreciated. Thanks

Related

How to return back to the application after webview?

The flow of application requires user to go to a webpage and update few details after which the user need to come back with id that website has provided.
Working senario:
User logs in application
clicks button goes to the website update few details
stays in the Webview for the website
Required Senario:
Should come back to the app with the id that website provided
The flow of the app is something similar to google Oauth where the user clicks the google button to authenticate google to use the google account.
You can show the web page in a WKWebView. Assuming you also are coding the web page you can also use evaluateJavaScript(:completionHandler:) to figure out when the website is done, grab the result, and dimiss the WKWebView. Alternatively you can intercept the success navigation with the WKNAvigationDelegate method webView(:didStartProvisionalNavigation:) and then grab whatever info you need from the server.

facebook - getting context of user that clicks on a FB shared link

Is there a way that of a link which an app shared to Facebook via open graph action to the news feed, which when a user/friend of the sharer clicks on it, it redirects to a landing page, where we could grab the information of the user (e.g. Facebook ID) just from the click itself? It might sound a bit magical, but anyone out there knows how?
Of course it´s not possible to just grab the user information just by his click, he MUST authorize your App for that. And you don´t get the real ID anyway, only an "App Scoped ID". Check out the changelog for more information: https://developers.facebook.com/docs/apps/changelog

logout does not work properly in struts2

i am developing a struts project.
In login page action stored username and password in session.
In logout action class using session.invalid and removed that session details and redirected to index page.
But i click back button in browser it goes to the previous page.
Now i need sample code for if i am clicking back button after logging out it will show the error message or it display index page like yahoo mail.
need sample for that in struts2
As I know, very hard to do JS side. because back button belong to web browser. Our project do below way:
When logout, close currently window and open new window. that will help you clear history.

Link on published action with opengraph

I've a trouble with my link on published action.
When my action is published, the link appear like that:
http://www.facebook.com/l.php?u=http%3A%2F%myDomain.com%2F%3Ffb_action_ids%3D3085543269620%26fb_action_types%3Dvideo.watches%26fb_source%3Drecent_activity&h=dAQF21zjX&enc=AZP6SPsPIfAKMoNKqLKjTEig1nsAERVmwUcrfURxEHA34JS11i5ofB29bXKBaOrkm0cOv-Lyg5IVTth3Kr308Qar
And I see on another app who used the same action, the link appear like that:
http://www.facebook.com/connect/uiserver.php?app_id=XXXXXXX&method=permissions.request&redirect_uri=http%3A%2F%2FTheDomain.com%3Ffb_action_ids%3D3056990355815%26fb_action_types%3Dvideo.watches%26fb_source%3Drecent_activity&response_type=token&display=page&auth_referral=1
Did you know why we haven't not the same publish link type ?
I want to publish with an URL like that: http://www.facebook.com/connect/uiserver.php?app_id=XXXXXXX&m.....
Best regards, sorry for my poor english :/
The link of the first type appears when a users click on a link which will take them to an external site.
The link of the 2nd type appears if the app has enabled Authenticated Referrals in the app's settings. When a user click a link of this type, Facebook links into the Authentication Dialog to generate an access token or OAuth code, the user is then redirected to the Action URL.

Twitter oauth authorization in a pop-up instead of in main browser window

I feel incredibly stupid for even asking this since the answer might already be under my nose but here it goes:
TweetMeme has a Re-tweet twitter widget that publishers can place on their blogs. When a user clicks on the widget, it pops open a window which allows the user to authenticate themselves with twitter and then re-tweet.
This seems to use some special Twitter oauth popup form factor - unless there is something fancier happening under the surface to authenticate the user.
The pop-up window looks like this:
http://twitpic.com/1kepcr
I'd rather handle an authentication via a pop-up rather than send the user to a brand new page (for the app I'm working on) and they seem to have the most graceful solution. Thoughts on how they did this?
I think that the process is something like this (I assume that they have used php on server-side):
First it opens a jQuery-like popup, but it's not strictly related to twitter sign in functions.
The real sign-in process begin when you confirm that popup, so it open new popup, with some php inside, that # hold a session.
Those scripts ask to twitter the request tokens, using site's application params, and save them into $_SESSION array.
If it's all-right, twitter send you to twitter authenticate page (https://twitter.com/oauth/authenticate), and after you have inserted your login params, twitter send you to the callback page defiend by that site. Here there is another php page that request access tokens, and save them into $_SESSION array. If it's all-right now the site has params that he needs for querying your profile, so last scripts inside popup refresh opener window (main site) and close himself.
Now main window has all the interesting params inside $_SESSION array.
Check this useful library for all the server-side work.
All they're doing is opening a page http://api.tweetmeme.com/share?url=someURL&source=tweetmeme in a new window (using target _blank), then starting the process from there.
EDIT: I was looking at the wrong retweet button. For your specific example, clicking the retweet button first opens Tweetmeme page http://tweetmeme.com/ajax/partial?... in a new window. Clicking yes then initiates the OAuth process by sending you (still in that window) to https://twitter.com/oauth/authenticate (with appropriate parameters).

Resources