How to develop a user defined plugin for a web browser.
It should features:
It should be installed in any browsers.
It should be executed whenever the browser starts.
It should monitor the web page and access the web page that the browser displays.
It should monitor and access the web page (for example, getting a value from a text box) irrespective of the web page the browser displays. (The web page can be of any URL either google or any domain)
How to start with it? It would be helpful if there is some sample. Thanks in advance
For Firefox < 4 write an Addon, for 4 and above Jetpack will be the way to go. For Chrome write a Extension. Opera, well wait till 11.5 ships. Safari 5. IE.
Read the documentation for each browser.
Hm...
I hope you tell the user about that.
Right now it reads like you want to deploy something to a PC and monitor all browsers, well if you want to do that you'll have to put some effort into it.
I don't think 1. is possible, you will have to create multiple versions of your plugin in order to work with each browser.
There is not a single example, because as I mentioned, you are going to have to do something different. You will need to determine and target specific browsers. I would suggest starting with one and once you have it have it working move to the next browser.
Do you mean a Plugin (like Flash, PDF Reader) or and Extension?
Plugins are native programs and extensions are normally coded in JavaScript & HTML.
Depending on what you want to do, an extension is enough powerful and the better choice.
There is no browser independent way to implement plugins. For each browsers you must read the interface reference. For example the reference for chrome: http://code.google.com/chrome/extensions/getstarted.html
Related
I have a daily task of downloading a Report[an Excel file] . Before I click the download button, certain fields have to filled and some checkboxes need to be checked. On clicking the executable file on my desktop, the whole process must happen in one go. I m looking for an opensource solution either in Javascript or JQuery to automate this download.
After the information you shared, I'm afraid you'll have to write an application in a desktop programming language. It doesn't really matter which language you use, and I'm not going to make suggestions since I don't know your situation.
The fun part will be determining what the browser does. The browser will basically send a HTTP request, either a POST or a GET (I don't know which one it is since I don't know the page). You'll have to open your developer tools in your browser, check what it sends and how it sends it and where it sends it, then recreate that using your language of choice. You then need to read the response and turn it into an excel file.
Now, this is quite challenging and I don't know how experienced you are. If you are willing to give up the desktop executable requirement, you can write a Greasemonkey script (in Firefox) or a Chrome extension (for Chrome, duh) which can automate this from the browser. Both use Javascript and are arguably easier to create since you don't need to recreate the HTTP request or reverse engineer what the browser does.
My supervisor has tasked me with programmatically reducing a website's content by looking at the HTML tags to reveal only the core content. Importantly, this particular piece of the project must be written in Java.
Now having learnt about the differences betweenPlugins, Extensions, Applets, and Widgets, I think I want to use an Extension that calls a client-side Applet. My approach was going to be this:
Using the Google-Chrome API, I was going to display a button that
the user can click.
If clicked, the action is to launch a new browser tab that has the
Applet embedded within it.
The applet automatically sources the called tab's HTML code and
filters it.
Once filtered, the reduced copy of the original site appears.
So I have a few questions. To start, is it even possible to use an Extension with an Applet? Moreover, is it possible for an applet to look # another tabs HTML code? If not, is it possible to just reload the original tab with the Applet now embedded within it and complete the function. Thanks.
Javascript is already on most mobile web platforms. Java is not, and there is no reasonable way mobile customers will be able to install Java. Android, which runs many, but not all, mobile devices has a Java run time environment, and is basically a loader for Java apps. But an Apple iPhone is not an Android device... nor is a Windows Phone.
If you want to summarize content on the client, and in Javascript, as I see it you have two choices:
Succeed with some inner burst of genius where dozens of the best expert PhDs in Natural Language Computing have just begun exploring how to extract "true meaning" from text; OR
look at document.title and be done with it.
The 2nd approach assumes that the authors of web pages set titles and set a title appropriate for summarizing their website. This isn't a perfect assumption, but it is OK
most of the time. It is also a lot less expensive than #1
With the 1st approach you can get a head start with a "natural language toolkit" that can do things like scan text for unusual words and phrases. To get a rough idea of the kinds of software that have been built in this area, review wikipedia: Outline of natural language processing:: toolkits. A popular tookit for python is called NLTK. Whether you use a toolkit from java, or python, it means working on the server because the client will not have the storage, network speed, or CPU. For python there are server side app frameworks like django or web2py that can make building out a server app faster, and on Java there are servlets frameworks. Ultimately you'll need a lot of help, training, or luck and as I have hinted above it can easily be beyond the capabilities of a small team of fresh hires, and certainly way beyond what a single new developer eager to prove his/her capabilities can do in a few weeks on their own with limited help.
Most web pages have titles set like this near the beginning of the downloaded HTML:
<head><title>My Furry Kittens!</title></head>
You don't need to write a parser. If you are running in the browser, the title has been parsed into the DOM or Document Object Model already. The string "My Furry Kittens!" in this example would be available in the global variable document.title.
If you like, you could put a button into a plugin and let people push it to summarize the website. Or, they could just look up at the title. It is already on the page. Of course, if the goal is to scrape titles one can avoid writing a parser and use a "fake" headless scriptable browser like phantomJS or similar.
You can read more about document.title on the Mozilla Developer Network. MDN is a great reference for learning how web browsers work. They are the maintainers of the Mozilla Firefox browser. Most of what you can learn there will also work on Chrome, Internet Explorer, and various mobile platforms.
Good Luck!
How about implementing a local proxy server on the mobile device. The browser would just need to be configured to use the proxy, while the custom proxy implementation can transform the requested html however it likes.
I want to choose certain tabs of a browser via java code. For example , I want to access 3rd or the last tab of browser and oper some web page over there. Is there a way ?
It might be worth looking at how something like adobe brackets does this. It uses the developer mode in chrome (I think) which allows it to interact with tabs in chrome. However I don;t know if this is available in a non developer mode.
I don't think it's possible.
You can probably do that if you are having your own browser running in java.
Is that possible?
before entering a site, it should check whether java is installed and it has to be of a specific version before redirecting to the designated page.
javascript cannot be used because it can be turned off by the user.
java applet cannot be used to check as it can disabled by the user
thank you.
I think it is naive to assume that someone would have JS disabled but Java installed & enabled.
JS comes with the browser, but Java does not.
JS is enabled by default, and has to be explicitly disabled.
Many sites today either rely on JS, or give a much slicker user experience when JS is enabled.
The deployJava.js
is the latest strategy offered by Sun/Oracle for checking that a browser has a
specified minimum version of Java before running an applet or including a launch link for JWS
applications. If 90% of deployers of applets in the last 2-3 years use the script, what do you think the
chances are of seeing Java installed and enabled in those browsers where JS is disabled?
Sun's former way of ensuring an applet had a necessary version of the plug-in was using
HTMLConverter, which produced the nested OBJECT/EMBED element so hated by validation services
(and any self respecting web developer). This invalid HTML used no JS or Java to do what it did,
it all relied on HTML & the browser/user's ability and willingness to act on the said elements.
However I do not recommend using that approach, I think deployJava.js is a better way to achieve it.
If you are truly insistent on making every attempt to determine the user's Java, and do not mind
'breaking the back button', there are other techniques that can be used. E.G. have a series of pages.
The first page has a meta-refresh redirect to nojs.html set at NN seconds and uses JS to redirect to
hasjs.html immediately.
The hasjs.html tests for Java:
Detect if Java is enabled
Check Java version using something along the lines of javascript:alert(java.lang.System.getProperty('java.version')). It works in the address
bar of FF to pop a dialog that reports 1.6.0_24 on this box.
(Finally) to determine that the applet itself is active (as opposed to crashed/refused at run-time),
see Detect if an Applet is ready.
So as can be seen, JS will not only be able to check if Java is enabled, but can also check the version & that any specific applet has loaded successfully.
You can prompt the user to input which version of Java they have installed. Otherwise, no.
Well, without using Java Applet and without using JavaScript. What else can you use? You are trying to access client specific data, you can't grab such data in the server side.
Rewrite your application in .NET, and then you can enjoy User-Agent lines like this:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;
.NET CLR 1.1.4322; .NET CLR 2.0.50727)2011-04-27 23:02:21
I wish browsers were sending same stuff for installed Java... alas, they don't.
I would like to create a folder selector for my application which will only run on Internet Explorer Browsers (IE6+).
I would like to get the full folder path a user wishes to use via a HTML browse button or similar and then pass this to my server side application which is written in PHP! This can not be done via JavaScript for security reasons so I am looking for any other alternative that will work.
I had implemented a solution using a Java Applet but this did not work out as it didn't work on IE6, plus the browser security is locked down where I am deploying this app, meaning I am unlikely to get away with an applet.
The current solution is getting the user to paste in the folder location into a textfiel, this isn't acceptable any more.
Any implementation advice welcome!
Thanks all
If your app is IE only you can create a simple ActiveX Control with only one method:
HRESULT BrowseForFolder([out] BSTR folderName);
ATL Wizard will give you major portion of code.
But I would consider using flash for this:
It is more widely used then Java (I
think so).
ActiveX is strongly depends on
browser's security options and more annoying to install.
Your task is rather small, so it can
be implemented without deep skills, if you not familiar with flash