How to interact with different android browser (get url) - java

I'm searching for a way to interact with different android browsers.
My intention is to get the URL of the website that is opened by the browser.
My app should run in background and give an alert when a specific url is opened, for now this is for testing and to learn more about android.
Is there any way to tell the browser to pass the url-string to my app everytime a new url is entered?
I've already got the idea to implement a local proxyserver wich checks all http-requests for a specific url, but is there a better way?
aditionally this should work with every browser not just the standard one but also eg. firefox or dolphin.
I already searched the last few days but couldn't find an answer....

Yes, you can do this! Check out http://seleniumhq.org/ for how to automate a web browser.

Related

Android WebView: How do I allow deep links?

When I click on a link within my WebView, it behaves as expected - it opens the link within the WebView.
However, if an app can handle that link, I would like to open that app instead. For example, if I tap on a Twitter link, I would like it to open Twitter, else open in-app.
This is how Google Chrome on Android behaves. This is also how WKWebView, the iOS equivalent of WebView, also behaves.
How would I go about implementing that? I have attempted to implement the solutions here but now my app always wants to open the system browser.
Deep Links as handled by OS itself. You just need to implement it properly. For example, in Android if you want to open the following url
http://twitter.com/intent/tweet?text=YOUR_TEXT
it will open the twitter app if the app is installed in your phone. Otherwise it will be opened in your browser.
But in case of iOS you have to specify the URL Scheme for opening in another app. Check the following url
twitter://post?message=YOUR_MSG
So when implementing this SO answer, you should also consider about the URL Schemes.
You should also keep in mind that webview in the application are implemented so that you don't have to open the browser app and no urls are exposed. If you want to open another app, you must consider opening the url in browser from your app so that OS can handle the rest.

Javafx webengine protocols

I've created a browser using Javafx, which works fine to go to websites but I'd like to be able to do external protocols (ie: chrome:// or, if you are familiar with nexus mod manager, it launches it via the web using nxm://). I am essentially doing the same thing as nxm on my website, but I want to be able to use the client I have created. Simply typing something like nxm:// yields an about:blank page. Is this possible with jfx?
Edit: I was thinking I could check for a prefix at navigation other than http and https and launch it completely outside the browser?

Redirect certain websites from an android phone using php

Is it possible when a user is using the internet on an android device and they go to a specific website they will get redirected to another static webpage by a php script. The IDE I am using is android studio.
Unless you make your own browser app it is not possible to access default or chrome or any other browser. Though you can make your php link that can do it so. Like... www.customlink.com which redirects to www.customlink2.com or anything, but it is from php side, not from andoid... :)
yes you can do that in php.
use the header function in php
Eg: header('Location:http://your_url.com');
You don't need any code on the android device. Take a look at this answer here on how to detect a user on a mobile device using php and then simply redirect him to another url.

Can you communicate with a browser window, after opening it with a JavaFX app?

My question is just as the title indicates.
I have a JavaFX app, and need to open a browser window. After opening it, I want to be able to communicate from the browser back to the app that opened it.
For example, if I opened the default browser window like this:
URI u = new URI(url);
java.awt.Desktop.getDesktop().browse(u);
Three options:
Through Javascript
Using javascript, and the window name you could access any window.
E.g. See: https://stackoverflow.com/a/16525481/1688441
Through Ajax Calls and a Server/Database
As another user answered, communication could be done with an intermediate server.
Third party library
The only other thing I can think of is using a 3rd party library to get the window within Operating System, though not much more I can suggest.
You can communicate back and forth with a WebView component. See http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm
If you are launching a page in the hosts browser, you'll need to develop a server based method to communicate.

identify the page load successful on the server side java

I am preparing a program in java and its purpose is to make the HttpWebRequest for a url which can open in any browser (i am planning to use watij for opening the page in different browser).Now my program should take the screen shot of the presently opened url once the page has loaded successfully.I need to run a piece of code after the browser has loaded successfully in the browser.I dont want to use the javascript document.ready function for identifying if the page is loaded successfully or not.I should be able to know the page load complete status in the server side (s0 that i can execute that piece of code for taking the screenshot).How can i do it in java.Or is there any other way to do achieve that if its not possible in java.May be create some plugins.
An early reply is highly valued,
Regards,Sagar.
you can do it using applet, [just taking snapshot i meant that you want.]

Categories