I wrote a simple WebUI for Android/iPhone where users have an account with logout function. They usually start the application via a bookmark on their homescreen.
I want to give them a handy button to close the web browser/page once the logged out.
Whit the following script, the browser prevents the action
<script>
window.close();
</script>
Is there a workaround that specially works on Android (default browser)?
Used tools/techniques
Tomcat and JSP
jQuery Mobile (1.4.x)
Android 4.2.x with default browser
Bookmark on homescreen
If I understand your question correctly, you want to use script to close the browser window itself? If so, you should read about this:
http://www.javascript-coder.com/window-popup/javascript-window-close.phtml
You'll meet some security restrictions with the close() function call.
Related
Scenario:
Browser opens on WebView
User clicks a link and opens the link on the default browser (Android, Chrome, etc)
I read that opening the default browser by WebView requires implementation on the native App.
But how does that work?
The back-end developer will give me the function and I'll call the function from the front end?
Also, how do I call that function?
Thanks for the help?
I have a typical modern web-app, regularly shared on Twitter.
I recently noticed that, when opening our web-app in the Twitter internal browser, localstorage is deactivated, which breaks our app.
How could I break out of the Twitter internal browser and open the page in the default Android browser?
I haven't tried this but just a suggestion. You could take a look at this and give it a try.
At the end of the article, it says that the external app won't be invoked if triggered without a user gesture but I believe that the limitation won't be there in case of the In-App browser.
Well, I think it isn't quite easy to say Android via a WebView to open the Chrome Browser as this in-app browser could be a lot different.
What you could try, as mentioned in the article Here is to trigger a click on an anchor which is calling an "pseudo" intent and add the fallback_url .
There isn't much details provided but it could be a possible hack / workaround.
In your HTML
...
And with JS:
$(".open_me").trigger("click");
According to the article
Now the URL will get you to zxing.org if the app could not be found, or the link was triggered from JavaScript without user gesture
(or for other cases where we don’t launch an external application.)
If you're lucky it will open the fallback_url, but as mentioned before it is a WebView which isn't the same as the Chrome Browser, therefore it is possible that nothing happens.
You can use a iFrame in your HTML like this:
<iframe src="url.com" width="900" height=400"></iframe>
I am struggling in disable alt+tab in IE8 web browser page. my page is a show modal dialogue.
You can't. If you want that kind of control over the operating system you'll need to install local software.
If you don't want to port your whole application to native you can write a native helper app that responds to a custom url scheme and processes it accordingly, like
myPopover://title/description
I have a web app which I am loading in Facebook iframes. The thing is my app opens File Picker which sends backs the data form where it was loaded. But if my web app is inside an iframe it doesn't allow File picker to communicate back due to security reasons.
So what I am doing it when the users on my FB page click on my app I take them out of the facebook and open my web app in browser. This thing works perfectly in Android or on my Windows. But in Iphone it doesn't takes the app outside and doesn't open it in the browser.
Do you know why? Is there a solution for it?
Seems the problem is a security feature of the browser's popup blocker.
It treats the window as a popup if it occurs outside of the callback of a user interaction.
It therefore gets buckets as a popup and blocked.
Unfortunately, iOS Safari gives absolutely no indication of this, making the issue difficult to track down.
I need a native app to fire a browser with some URL that will take the user to a mobile website. Inside the mobile website, there has to be a button that closes the browser (or sends any signal to the native app) so that the user gets back to the native app. Currently I'm trying to close the window, but I don't think that's gonna do the trick in all mobile devices.
My code:
$( document ).bind('pageinit', function(){
$.mobile.activePage.find('#close').click(function(){
window.open('', '_self', '');
window.close();
});
});
I'm using jQuery mobile.
Setup a custom URI handler (for Android and for iOS). Then all you have to do is redirect to a URL that matches, perhaps using window.location.
It seems that there are security restrictions that wouldn't allow you to close the window via JavaScript. See here
EDIT: You basically have two options: implement a custom URL handler for each platform you're developing for; or embedding a web view into your application (UIWebView for iOS or WebView for Android).
On iOS if you launch Safari from your app you won't be able to get back to your app after Safari closes, unless your app is registered as a custom URL handler and the page you are on launches a URL that launches your app.
On iOS if instead of launching Safari you show the web page in a UIWebView you have control over exiting the page.