Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

embedding Javascript in SFSafariViewController

I'm not sure if it's possible. I'm currently developing an app the stores password (like a password manager). One of its features is to allow user to make an auto login to a web browser of that device. I was able to make it work using UIWebView and WKWebView but can't find a way to make it work using SFSafariViewController. I read few documentations and blogs about it and even read the SFSafariViewController.h but there's no clue in there that can lead me to the function that I wanted. I want to know how to do a "evaluateJavaScript"-a-like function in SFSafariViewController or if its not possible, do you guys have other suggestions on how to achieve this?

Note: I'm using Objective-C.

Thanks in advance! Happy coding!

like image 420
mCube Avatar asked Jan 26 '16 19:01

mCube


1 Answers

SFSafariViewControllers are sandboxed. As they are essentially Safari, and have access to cookies. It would be a security risk to allow any app to access these.

However, if the web-service you want the user to sign in to is yours, you can setup a API and a custom URL scheme.

Follow this documentation.

If you are trying to store passwords etc from sites you don't maintain then unfortunately, this is not possible using the SFSafariViewController.

Hope this helps,

Liam

like image 122
Liam Ferris Avatar answered Oct 11 '22 18:10

Liam Ferris