Chrome extension as GUI for JSON API

I'm working on some huge project using PHP , which is CRM and the Smart Ticketing and Processing System for travel agencies, and I plan to make it available only on chrome.

And I'm new to Chrome Extensions/Apps . But when I read about creating extensions, I was surprised that I could create any html content with any JS codes included.


My questions:

  • Can I enable the application GUI with pure HTML && CSS && JavaScript in some extension and make it send / receive requests to my PHP-API that already exists in my code, since it is completely AJAX project?

  • And if it can be done; what I need to create a Google-Chrome-App or Google-Chrome-Extension And what is the difference between them and where to start reading about the necessary solutions.


IF , this can be done since GUI elements ( HTML , JS , CSS , Images , etc.) will be loaded from the local storage of each user / employee machine, and the only data transferred will be JSON requests.

+6
source share
2 answers

Yes, you can create your GUI in pure HTML, CSS and JavaScript. This is actually the only way to make a GUI in Chrome extensions. Your PHP-based API can certainly be accessed through an extension if it is designed as a fairly typical client-side API.

Here is a brief description of the extensions and packaged applications:

  • Extensions are usually designed to improve browser performance. For example, the analysis of pages viewed by the user and the selection of text. Chrome provides some amazing browser and browsing experience APIs. However, it's just JavaScript, CSS, and HTML, so you can definitely do it even further and create almost fully functional applications. However, there are no specific user interfaces in the extension APIs that make building a complex web application easier. This is not the purpose of extensions. Look at the extension in the Chrome Web Store to see some examples. Development documentation can be found here .

  • Chrome Packaged Apps lets you develop a full-blown desktop application using HTML, CSS, and JavaScript. You can create sophisticated applications with typical web technologies. This is a fairly new technology, but there are many possibilities.

  • There is also a slightly confusing concept of a β€œChrome app,” which is actually a way to package a typical web application (or site) for display on the Chrome Web Store. This is not a true development technology.

Keep in mind that Chrome extensions and packaged applications are not the basic user interface for creating web applications. These are special technologies to improve the browser and create applications similar to desktop PCs, respectively.

For example, if you create Amazon.com, you will not create the main website as an extension or packaged application. You probably developed it using a typical development web stack and released it like a regular website. You can then create a Chrome extension that displays a window in the Chrome browser and displays your recent orders or finds products in the Amazon store when browsing the Internet, but you probably would not have created the entire site as an extension.

With Packaged Apps, you can create a desktop application that interacts with Amazon, but it really is just a desktop application.

+5
source

Yes, of course it is possible, but what you are doing is a web application. The chrome extension is literally a chrome extension (which must be installed) written in C or C ++ (javascript, html and css are possible). The convenient thing about a web application is that it can be used (in every browser) without the need to incorporate any additional components.

To be specific, Google has extensions and applications. With a particular chrome app, you can do more than a regular web page. First, people had to install the application and agree to the terms of use. this has made you more javascript capable, which is usually forbidden for a random web page.

The extension is designed to add or change features in chrome, such as adding your own video player extension to play avi or something like that. Not for building a web application.

If I just create a regular web application or create a chrome-specific Packaged application .

In your case, you are creating a private web application. If it will be used inside lan, you can just create an intranet and run your webapp there. If it should be used globally over the Internet, you just need to provide it with a registration.

Or create a desktop application.

+2
source

Source: https://habr.com/ru/post/952556/


All Articles