Most browsers allow extensions for them. But, as I understand, there separate extensions needed for different browsers.
Is there any way to write one extension for all browsers? Can such thing be created Java, .NET, or Python?
In my opinion you can use Crossrider, with Crossrider you will write one JavaScript code, that will produce an Chrome,Firefox and Internet Explorer compatible extension.
Crossrider have a powerful API that hide all complexity while writing cross-browser code.
Try to give it a shot in: http://www.crossrider.com
Disclaimer: I worked at Crossrider
It depends what your extension does. Theoretically if your extension is quite simple (e.g. it doesn't require any special APIs like http, or filesystem access and it doesn't modify browser layout), than theoretically you can reuse the same code between browsers (but since each browser has its own extension format, you must create descriptors/browser specific code for each extension). Writing extensions in language other than javascript is possible by using some Name our language to JS compiler. For example SpeedTracer for Chrome is partially written in GWT (Java to JavaScript compiler).
So in short, you can reuse the same code between extensions for different browsers and you can use languages other than javascript to create browser extensions.
Related
Coming from Node.js and now working with Java I'm wondering about how to achieve with Java what I did with Node.js, more specifically: How to compile my templates into JS functions.
What I did before was using EJS templates, then they were compiled into a single JS file that exposed functions to call from JS with parameters, these functions returned a HTML string that I could use as it to update my view.
The great thing about this is that I could write my templates in separated files, (EJS) then dynamically Grunt/EJS (I guess, that's from Sails.js internal logic) was converting the template into a function, merged all of them and finally generating a single file usable in my app, I just had to call a function, provide arguments and that's it: I get a view dynamically generated.
I want to achieve the same in a Java environment, using Ant, maybe maven, but I don't know how to do it neither where to look for since I'm a Java novice.
Edit:
I'm talking about client-side templating, I just want to avoid the -ugly-traditionnal way to write HTML code inside JS strings and split them in separated files so I can maintain them easier. I only need to use them from JS, not from Java, but I need to "compile" them from a Java environment, using Ant.
This is somewhat similar to this post, and this one, so you may have a look there to see if there are other useful answers.
A consensus seems to be that Mustache, which has a Java-implemented compiler (among other flavors) could be executed as an Ant target. It's a logic-less template, so you may want to find another solution.
Because it is possible to call Node.js scripts from Ant, it seems like an artificial restriction to not have Node.js. You will have much more choice and flexibility in template choice if you can persuade your team to allow Node.js.
Node.js is not in an either-or relationship with Java tools. There is plenty of room for both on a project, and I've worked on C# projects that use Node.js, just as I've worked on projects that use JRuby, Java, and Rails. None of those technologies excludes the others.
Note that I'm not recommending that you try to persuade people to switch to Node.js as an environment, migrate existing code, or use Grunt, but if it's a useful tool that you're familiar with, I can't think of a single good reason why you should be denied its use.
Another solution is to use this library I discovered yesterday. I've tried it and it seems to work well, some features are also quite useful for development mode, like the watcher on the templates.
http://jcruncher.org/
I think I'll go with it, just wondering about the author and his implication, and hope to see a Handlebars 3.0.0 compatible version soon, as well as the source code on GitHub.
P.S: You can find the handlebars compiler on the CDN (select the 2.0.0 version):
http://cdnjs.com/libraries/handlebars.js/
https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.runtime.min.js
I thinking about creating a Firefox add-on but the problem is that as i can see add-on to Firefox is build with HTML and javascript that is not nearly powerful enough for my needs. So I was think what if i build a interface with this and then just write the rest of the program in a language that can do what I need. Then i just have the javascript call on methods in my main program and have it present the result.
The program language I had to mind to use was erlang, this language is however not mainstream and if it is not possible to do it with erlang I can settle for java. So assuming it is possible to do how do I go about doing this?
They don't have an XPCOM module to talk to erlang. If you want, you can make a DLL for windows (and etc for other OS) then use js-ctypes to talk to your DLL to talk to erlang. Do you know how to make DLL?
Just out of curiosity, between <applet> vs <object> for a Java applet, which one should I use? I know that <applet> is deprecated, however Sun still recommends the use of <applet>.
Is there any drawback between the two tags? Because when I use <object> for Mac in Safari, it causes a problem saying that the page can't load, even though the page loaded properly, and when I check the activity window it said that the class was not found/cancelled. For example:
Use applet if you have found that it works more often. The object element was introduced as a theoretical unification that would be a catch-all for any embedding of external data. It never worked well, and modern HTML development has effectively abandoned the unification idea. HTML5 introduces audio and video, for example and keeps img (logical unification would surely deprecate img, because an image can be embedded with object).
Use deployJava.js as mentioned in the applet info. page..
..To avoid browser compatibility issues, the Deployment Toolkit script provides JavaScript functions that automatically generate the HTML required to deploy RIAs. Developers should invoke these functions to deploy their solutions in a consistent fashion across various browsers.
Then you don't have worry about whether the script writes an applet, object or embed element.
As an aside. Copy/pasting the text from the Activity window would be a lot more useful than a screen-shot. Now I look (squint) at it, it seems the only two lines of output that are in any way relevant are:
http://admin.file-lift.com/css/none not found
http://admin.file-lift.com/com.pspinc.util.FileUploaderApplet.class cancelled
The css/none is not a class or a Jar, and neither of them exist on the server. So that applet has problems beyond the HTML elements used to deploy it.
Use <object>. <applet> was deprecated back in HTML 4.01.
Unless you're targeting a stone-age environment, there is not reason to acknowledge the existence of the applet tag.
I think Sun has a point. HTML5 says:
The applet element is now obsoleted so that all extension frameworks
(Java, .NET, Flash, etc) are handled in a consistent manner.
In other words, it's no longer valid for reasons of theoretical purity and not because of any practical problem. Frankly, I find <applet> simpler and more reliable to use in the real world and continue to use it.
While deployJava.js might hide the gory details away, the reality is that under the hood, it still uses <applet> in some circumstances.
I've read a bit on client-side browser languages and tried a few out but I'm not convinced I know of all the options. To make it clear, I'm looking for something that can be processed either through the browser or otherwise on the clients computer with minimal need for additional installations/configurations.
At the moment I know of JavaScript, Java, and Flash ( I'm aware this isn't actually a language, but seems pertinent to mention it still as an option). If at all possible it seems like avoiding Flash would be best, but it's still a consideration. I know there are various flavors of JS and Java but I don't really know of any that make the end-product that different than just the raw language. Java and JavaScript both seem relatively slow when it comes down to more complex and weighty apps, though performance is always improving as our browsers and libraries get better.
All this said, is there anything available or about to be available that will do things better?
JavaScript is the only native browser language that’s widely supported. Flash isn’t native, but it’s the most widely-supported plug-in.
Nothing else yet seems to be installed widely enough to be worth considering in general, although obviously you should always try to figure out what the actual/intended audience of your specific project has installed.
JavaScript performance has come on leaps and bounds in the latest versions of all browsers as it’s become more widely used.
As far as interface programming goes, the only thing JavaScript has built in is the DOM interface, which lets you programmatically control the HTML page that the JavaScript is running on. The DOM interface is pretty raw and basic, so there are lots of frameworks that try to make it more palatable (like jQuery), and frameworks that seek to provide libraries of desktop-like UI controls (e.g. jQuery UI, Cappucino).
JavaScript is the main language for client-side browser development that interacts with the elements on the page, does ajax requests (update screen without a full page refresh), etc. Depending on your specific requirements, I would recommend JavaScript, as its most likely the tool that will accomplish your needs.
Java is NOT a client-side browser language, Java is a programming language, you can write apps in Java and embed them in a website, that is called a Java Applet. This will require that all users have a JRE installed on their machine for your applet to work.
Java has nothing to do with Javascript -- they share some similar syntax, and thats about it.
Flash is a browser plugin, if you want to write a flash application, ActionScript is the language it uses. It still requires that anyone going to view your application have the Flash plugin installed.
HTML5 is the future.
Currently many features are achieved with JavaScript, but these are being wrapped in libraries (e.g. the "polyfill" library Modernizer and even in other languages, e.g. Java with GWT. This is an area in a greater state of flux than most.
You forgot unity.
Unity is an up-coming client-side application development platform. It does require installing just like flash but it's a lot more powerful then flash and seems to be picking up popularity.
Unity has a lot more inbuild framework rather then doing it in HTML5+JavaScript. I would say these are your two main options. For an example of javascript & html5 in action look at cloud9ide
One of the big advantages of unity is the 3D engines.
Java applets are so 1998 and are not an option.
i need to compress my css as part of my ant build. i noticed that csstidy does this, but it would not be easy to include this in my ant build because i would need to use a different binary on different platforms.
so, is there a java css compressor that people use?
Check out the Yahoo YUI compressor.
It compresses CSS as well as Javascript, and it's written in Java.
Edit: You should be using some sort of HTTP compression as well, like mod_deflate or mod_gzip.
I recently released CSS Compressor. It's a code fork of YUI Compressor, but adds more compression enhancements that make it more similar to csstidy, particularly with regards to grouping selectors that share the same rules. Obviously it's Java, and can be called via the command-line or used as a library within your own Java app.