can I call javascript of a website without opening in webview - java

Is it possible to call the JavaScript of a website without opening it in webview.
I am using URLConnection to get the html but I want to click a link on host website that in turn call a JavaScript function through Java code.
I want either to call JavaScript function or the link on click of a button on activity
webview.loadUrl("javascript:") is able to do it but only after opening in webview.

As I know it is impossible in current Android. In 4.5 there will be some script-engine to execute js or other scripts. BTw, why do you need this - to get content after click on content? seems strange..

Related

Java Browser handle button click

I need to open a browser with URL and then wait till person clicks a special button. And if it happens, return true. Can I implement it with java tools or should I use javascript?
You should use JavaScript. Java is a Server side language, so all processing of Java code will be completed before the user has the chance to interact with the page. JavaScript (traditionally) works on the client-side and is commonly used to capture user interactions with the browser.
yes, Java Script or any frame work that builds on Java script like Jquery works for you. If understands you correctly,
create Hyper link
Browse the page that you needed
Place HTML button on the page, write onClick logic on that button to return true.

Send JS commands to browser tab

I want to send a command to my browser, let's say chrome.
For example, I use a website which has a really neat audio player, i know this audioplayer has a javascript function called prevTrack() and nextTrack() etc etc etc.... what i wan't to do is to create a program (in java/c#) that would go into the browser console and send that command, if for example, I hit some kind of hotkey "ctrl + n" for example.
Is there any way to manipulate chrome like that?
Thanks
You could write an application which incorporates the browser into Java using something like http://djproject.sourceforge.net/main/index.html - it can open a browser window, navigate to a location, and then execute arbitrary Javascript.

detect if flash is installed without js

If flash is not installed, i want to replace the flash animation with a jquery animation.
BUT if flash and js are not installed, i want to display a div with a message to the user.
how is it possible to check if flash is not running at the clientside without using js?
kind regards,
Use a javascript event to replace your message with the Flash animation. If Javascript is not running, you will see the message instead.
SWFObject is a great little tool for completing exactly what you want.
Add to HTML body classes: "no_flash no_js". They will be your default when js & flash not available.
Then when you have js, with it's help remove no_js class.
With help of js try to determine flash and if it's present, show flash else -- js animation.
Do it the other way around:
Display a div with a message
If JavaScript is on, replace the div with either:
a) a Flash animation, if Flash is installed or
b) a jQuery based animation

Is there a way to load an applet in chrome extension?

I have written a class for my application and want to use it in making chrome extension.I tried loading applet in popup.but it seems that chrome has blocked applets. The functionality i want to embed is when user visits a page he sees a button on omnibox..when user clicks the button i want to send some page elements to my applet which processes it and saves it as a file in the filesytem. for this i want to dynamically add the applet to dom..or atleast if i can load the applet its fine!!
This is a known limitation between Java Applets and Google Chrome, for more information please refer to the following issue: http://code.google.com/p/chromium/issues/detail?id=30258

How to render a web page with android jdk?

I want to show the web page normally,but still keep the user in my app,
how to make use of the available web render engines programmatically?
UPDATE
I'm now using the webview ,but can't render the page,reporting 404 page not found.
However,when I pack my project and run in another computer,it works like charm!
How to solve this?
Use a webview and implement webkitclient if needed.
More info here
Please explain your question. I cant understand that you want to open the webview with the URL or by the html code. Both of them is totally different. Please explain how do you want to open the webview in application by URL or by HTML
You, as of now, probably let your app open the device web browser to let the user see the content of the URL, via an Intent Action.
Use your activity which uses a WebView and implements its own WebKitClient. Then you can make the user stay in your app and control what and how content is fetched.
#Achie has a nice link for you which explains how Web things work in Android.
To know how to work with WebViews, go to this URL and read the nice article-cum-tutorial

Categories

Resources