Access Text Field & Button of any webpage with java - javascript

I would like to access any input element on webpage with the help of java.
For example:- lets user has opened any website which contains 2text field & 1 text area and submit button.
So what I want is that, all that field should get typed by my java programs.
I have speech to text converter and it works fine.
So what I want is that if user open a site T would like to type some content then by speaking it self that content should get types on the web page.
Say for example,
Post on facebook.
Search friend on facebook.
Querying text on google without query string, means text must get types on browser and user must realize that text is getting typed as he is speaking.

It is a wrong approach to use java or javascript here, you need to modify the browser itself, for example you can check
https://wiki.mozilla.org/SpeechAPI

Related

How do I create a hyperlink inside an input text field in html?

I have an input text field in which the user can enter the name of a website. Is it possible for it to be hyperlinked so that once the field is saved, if the user clicks on it, it redirects to the website?
I use Django for the backend and Javascript and html for the front end.
An input field's value is stored as plain text, therefore you cannot include HTML (i.e. a link) and expect the HTML to be parsed and functioning.
You could simulate this behavior with JavaScript, however I would recommend against it. (You would add a click listener, your function would pull the value of the field, see if it is a valid URL, and then open up the location.)
I'm not going to write the code for this because it would be a terrible user experience. The standard behavior for an input field is that you click on it to edit the text. This is an assumption your users have, and they would therefore (a) not think to click on it because they don't expect it to be a link, and (b) click in it if they wanted to edit the text, only to be redirected and unable to edit the text.
Alternatively, you could add a small button next to the input, i.e. 'Open' or 'Test' or an external link icon.
Simply, if you are printing the URL for the user on their profile page, sure you can just print it as follows:
<a href='$url'>$url</a>
That's PHP but of course you can do this in any language. I'm not sure if this answers your question since you ask if it can be printed "inside" the field which isn't possible/doesn't make sense.
HOWEVER, think about security. Remember the user can enter any malicious URL into this field, so you need to be aware of who you are potentially linking this to on your website/application.
Useful resources:
URL HTML field:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
Validate URL format with Django (does not check if malicious or not though):
How can I check if a URL exists with Django’s validators?

JavaScript dummy/proxy input for another DOM element

I'm using an iframe to get the content of a registration form on a web page, and, as I have to show this registration form inside an HTML app for Android, I'd like to analyse the html inside the iframe to search for input textfields and to use my custom text field as "dummy" or "proxy" for the considered element:
Let me explain better:
As the web page wouldn't give the user the same easy approach as an app, instead of clicking on a textfield and having the problem that the virtual keyboard overlaps the other fields making it difficult to go further.
I want to create a div that covers the iframe and has a text field inside with the same functionality as the one clicked: by this way after entering the text into the dummy field and clicking an ok button aside, the clicked field would be updated and all the other things hidden (virtual keyboard, etc.).
It would be simple if the goal was just to copy a text from a field to another, but the real problem is that the clicked field could have some events like onkeypress or onchange (e.g. to autocomplete) and so on, and I should get the same behaviour on the dummy field.
In an imaginary world I'd do:
document.getElementById("dummy") = document.getElementById("original")
And then destroying and recreating the dummy whenever required.
Do you know if is there something possible to do?
You can't read a div from inside of an iframe after the iframe has loaded. The reason for this is to prevent hackers from making programs that can grab your credit card numbers from web-based forms through iframes and then use the apps to record them.
UPDATE
You would have to retrieve the entire form in the background, then render it again using webkit, then when the person clicks submit, you would have to submit the exact same form data to the host from your device.
Its possible, but I don't see a good reason why you would ever need to use that.

Capture text input in Google Web Designer expandable banner

I'm creating an expandable banner with Google Web Designer and I want to allow the user to type their name/email in to a textbox and to capture the value to report in the campaign.
Going to the Tag tool I created an input field and dragged it to the page. When I preview I can type text in there, but I can't raise any events and it doesn't log anything to the console.
How can I capture the users input? I thought it would be easy as it supports HTML5, but I can't see how to wire up my input field
There is no built-in functionality for accomplishing anything with form inputs since GWD is intended to be used to create ads for Google's Ad Network which does not support any interaction other than clicks. However, you can use Javascript just like you would if you weren't using Google Web Designer.
You would just give the input an ID and create a button to grab the value of the input and then you could do whatever you want with it.
For example, if you added an input with the ID of name and a button with the ID of button you would add this in your Code view within the gwd-init-code script tags:
document.getElementById("button").onclick = function() {
var inputVal = document.getElementById("name").value;
alert(inputVal);
};

JavaScript to make an action on an input box

Don't shoot me I'm new to this web programming. I'm an old (and rusty) VB programmer. I've been reading a little about js, php and html. Basically I've never used 3 different languages in one document.
Say I create an input box the user has to enter a value in, using html. Obviously this box is named say
"name First". Can I use js to grab the data in the box to preform an operation.
My idea is that I'm creating a form, I want to be able make copy and paste easier for the user. If I can I want to use js too copy all the data to the systems clip board if they double click on the input box. I'm using php because the form will be interacting with a database.
Thanks
Yes, you can get the data from an input box with Javascript.
Suppose your input field looks like this:
<input id="firstname" type="text">
Then you could get the value of that like this:
var firstname = document.getElementById("firstname").value;
Javascript does not have the ability to interact with the system clipboard directly for security vulnerability reasons. There are some work-arounds using an Adobe Flash component called zeroclipboard, but these won't work if Adobe Flash is not installed. Or, you could simulate your own clipboard (likely using local storage) that would work just on your own site.

Scraping a dynamically generated webpage with HTML5 <input> field

I want to collect data from this page. I have keywords I want to input in the search box, which is defined as an HTML5 <input> with an eventlistener that dynamically changes the page based on the query.
For example, I want a script that inputs the term "hello world" in the search field and then scrapes the dynamically generated content, say the name of the collections that appear. Because of the Same Origin Policy I can't use JavaScript and I've spent the last 3 hours looking into Python but couldn't find anything there.
I can't tell if this is so obvious no one writes/asks about it, or it's a clever way to not let scripts scrape from your site.
Open the page in Chrome's Debugger or Firebug in Firefox and look at the Network Tab and find out the AJAX requests the JavaScript is doing when you enter text into the input field(s).
Then write a webscraper using any of:
https://pypi.python.org/pypi/requests
https://pypi.python.org/pypi/spyda
https://pypi.python.org/pypi/scrapy

Categories

Resources