简体   繁体   中英

Java backend for browser extension (Firefox add-on)

I intend to add visualization effects to existing web pages , powered by a MySQL database in the background. I assume this adding stuff to existing web pages requires writing a browser extension.

For example, when Google returns search results, I want to customize the web page displaying (such as adding some bubble visualizations onto that page's blank places), the visualization is driven by data provided from the backend.

Based on my knowledge, a typical web application involves JavaScript running on the frontend, Java backend. A web application will generate a brand-new web page normally, not adding new stuff into existing pages. The web server is supported by Java Servlet, Tomcat, etc.

How can a browser extension (such as firefox add-on, chrome extension) talk to the backend Java programs? Is there existing template similar to Servlet/Tomcat that can do this job?

How can a browser extension (such as firefox add-on, chrome extension) talk to the backend Java programs?

In the case of a firefox extension it's quite simple, you have pretty much the same privileges as the browser itself. Ie you can just open sockets, access the filesystem or maybe even use named pipes. Ie all the usual IPC mechanisms.

I don't know much about the chrome APIs except that they're more restrictive. But I assume that at the least they can create HTTP requests.

So at the very least you can simply do JSON or XML-based message passing via HTTP requests to your server application.

For the server-side technology you likely want to use whatever provides a simple REST API to address form the client side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM