Is it possible to change Safari settings in a native app like following :
Accept Cookies : Never
Javascript: Off
Clear History, clear cookies and clear cache
Is the above possible and legal to do in a native app?
Nop. You can change the cookie settings for your app only.
I guess you are talking about a webview in your own application?
1) NO
You can delete them though: How to delete all cookies of UIWebView?
Also right after creation: Cookies in UIWebView
2) NO, its a system setting: UIWebView: Can You Disable Javascript?
3) There is no saved history in a webview. For cookies see 1),
for the Cache see: How to clear UIWebView cache?
Also interesting: UIWebView cache in iOS and Clearing UIWebview cache,
Related
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]);
I'm Developing an App using Phonegap, target Devices are Android or iOS driven. My Problem is, that on the iPhone I can only set the "open all whitelist urls in webview" parameter to true or false. So that is the Problem:
Expected Result:
- All links (like www.google.com, www.stackoverflow.com) should open in the Browser
- An embedded iFrame with a Youtube Video should open in the Webview
Result with "OpenAllWhitelistUrlsInWebview" Set to true
- All links and iFrames will open in the Webview
Result with "OpenAllWhitelistUrlsInWebview" Set to false
- No links and iFrames will open in the Webview
How can i specify which links should open in the Browser and which shouldnt? When i remove an url from the whitelist the link won't open at all and also setting target="_blank" wont work properly. Trying it with window.open didn't work either.
Thank you very much for every idea.
Implemented this over the weekend, and it's working great:
http://www.rigelgroupllc.com/blog/2012/05/22/opening-links-in-phonegap-apps-in-mobile-safari/
This will allow you to set up your plist for the youtube video, while using the above method to open specified links in the external browser.
I'm not sure what/if you need to do anything in Android.
So I have a web page inside my bundle, which I load in a UIWebView. However, the page doesn't seem to be able to store any cookies, even though other (online) websites can. How do I get it to store my cookies?
I don't think you can. Cookies are connected to a specific site and path. That does not map well to documents served from disk.
I don't really see a simple fix for this. One thing you could try is to embed a little web server in your app and then use it to serve that content on localhost.
You can. I load an html file from my bundle and it saves cookies fine and I reload those cookies next time it starts up no problems. They are in the CookieStorage. If you dump out all the cookies in there for your app you should find any cookies your application saved.
even if you have trouble getting your webapp to save the cookies you could always explicitly retrieve the cookies via javascript and in obj-c code save the returned data into cookiestorage. Some tips on using cookiestorage...http://blog.andrewpaulsimmons.com/2008/08/add-set-and-delete-cookies-in-uiwebview.html
I have an app that uses OAuth to authenticate, which means the user must be directed to the website to authorize the application. I prefer to make it obvious to the user that they are using a standard browser to authorize at the original site rather than just using a web view to show the content within my app. However, every time they are directed to Safari (via openURL), it launches a new Safari window and once Safari has 8 windows open, it simply fails to work at all.
I'm wondering if there is an equivalen to the "target" attribute of an anchor tag in html which would allow me to cause all openURL calls from my application to open in the same window.
There is other functionality that I can expose via the web application, creating a hybrid app between native iphone functionality and web app functionality in Safari, but if I have to launch a new window every time I switch between the app and Safari, it becomes unworkable. The Youtube app is obviously able to return the user to the previous page after showing a video, but that might well be a custom plugin in Safari for iphone. Also, while returning to the previous page is somewhat useful, sending them to a new URL in the existing window really opens up a lot of possiblities.
I'm pretty sure there is no way to pass a target parameter to openURL:.
What I noticed about Safari is that it won't open another tab if the page you are opening with openURL: is/was already open in Safari. It just reloads that page. This might sound trivial and not helpful but perhaps you could use it to your advantage if you can make your web application only use one page. Different views or states could be expressed with #anchor tags.
An example is http://m.flickr.com. Notice their URL structure? It goes http://m.flickr.com/#/home, http://m.flickr.com/#/explore/interesting/, http://m.flickr.com/#/search and so on. All of these are different web pages to the user but to Safari it's all the same page.
I found iOS 6.0.1 Safari will open the same tab with a simple hashtag, without the slashes. So with the above example http://m.flickr.com, openURL to http://m.flickr.com#someinfo opens to the same tab.
In your webpage, use window.location.hash to return the params. In the above example it will return #someinfo.
I have tried using iframe, javascript and image tag Ad tags in iPhone application, but none of them work. When a user clicks on an image, the browser is launched but then nothing happens (you get a blank page). Anyone know how to proceed?
To proceed: debug it. A standard OpenX click URL will do a redirect. What URL is the browser sticking at?
I don't know anything about iPhone applications, but I do know about interfacing to OpenX. You possible should consider using the OpenX API, which will allow you to pull all the information you need into the 'back end' of your application, then use it as you need.
Proplem in iphone must be active enable java in iphone safari settings