How to detect url change through AngularJS in UIWebView - iphone

I am using UIWebView which load a url of website which using AngularJS. When its load an new url (AngularJS routing) its not detecting by UIWebView delegate . How can i detect if url change in browser.
Thanks

Get the current URL from window.location.href after the angular has been loaded, not from the UIWebView (webView.request?.url?.absoluteString).
webView.stringByEvaluatingJavaScript(from: "window.location.href")
Reason: It's mainly because the URL is internally managed by the Angular router.

Related

Flutter web: Webview with payment gateway not working

I have created a flutter web app running in chrome, in which I have used webview for calling the payment gateway(which we have set in the backend server).
In that URL after entering card details we redirect it to moyasar url at that time it throws an error as follows:-
Refused to display 'https://api.moyasar.com/' in a frame because it
set 'X-Frame-Options' to 'sameorigin'.
Looks like you are displaying the URL in an iframe. Make sure you are displaying the URL directly on the web view component.

How to use cookies in Android Webview

I am using a webview to render the contents of my Website.
I want to use Cookies in this webview to Auto Sign-In the users in that web site.
So, can anybody help how to use cookies in Android webview?
Enable your browser to accept cookies using CookieSyncManager. Everything else you wrote regarding cookies on your html side will work fine.
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
CookieManager.getInstance().setAcceptCookie(true);
WebView webview = new WebView(this);
webview.getSettings().setJavaScriptEnabled(true);
setContentView(webview);
webview.loadUrl([MY URL]);

Is it Okay to launch web URLs in UIWebView in iosApp?

I am not sure if this is grounds of app rejection or not:
In my app I receive JSON data from webserver and it has html content like
"[html] a href www.mycompany/view/regulations.html"... click for regulations...[/html]"
Is it okay to show the contents of the url above when clicking on "Click for regulations" link, or will this be rejected because I am under the impression that all html has to be carried locally?
That shouldn't be a problem. We have an app were our TOS is loaded from an (online) URL. What they usually don't like if your code loads from an external source.

Invoking another application using URL Scheme in iphone

i want to load another iphone application when i click the button on the current application. The application which has to be loaded is DataStore (appl name). I added URL scheme to this application in plist file. URL scheme is dbapp, URL identifier is com.dbapp.
In the current application(Testdb) i have the code is
-(IBAction) btnClicked {
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"dbapp://"]];
}
But it is not invoking the DataStore application when i click the button. please help me out.
Thanks.
You can try to embed a link into a hmtl document and have the embedded Safari load that html - e.g. via an external server or maybe.
When you click on the link you should see the registered application load. If it doesn't then you have to look for the error in registration of the url-handler.

Can I let a user select a contact from his iPhone's contact list in a web application?

So that only a single contact is passed to the web application with the explicit permission of the user..
hum, in a "pure web app" (that you access from a URL in the mobile safari) I don't think you can.
However, you can :
embed a UIWebView (that accesses your webapp url) into a native app
when the user clicks in your webapp on a HTML button "contacts", you open a page with a custom protocol (let's say myapp://contacts)
then, in the delegate of the UIWebView, the callback shouldStartLoadWithRequest will be invoked. Check that the scheme of the URL from the NSURLRequest corresponds to myapp://contacts and based on that, trigger the opening of the ABPeoplePickerNavigationController to enable the selection of a "native" contact.
once the contact has been selected (delegate of the previous controller), you reinject this selection into your UIWebView using [myWebView stringByEvaluatingJavascriptFromString:myJsFunctionToInjectContactInfo
I'm using this approach and it works fine.