Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension as GUI for JSON API

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

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


My questions are:

  1. Can I include my application GUI with pure HTML && CSS && JavaScript in some extension and make it send/receive requests to my PHP-API Which already exist in my code since it's fully AJAX project?

  2. And if this can be done; what do i have to create Google-Chrome-App or Google-Chrome-Extension And what is the difference between them and where to start reading about required solutions.


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

like image 234
MaveRick Avatar asked Aug 27 '13 03:08

MaveRick


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 via an extension, if designed as a fairly typical client side accessible API.

Here's a brief description of Extensions and Packaged Apps:

  • Extensions are generally designed for augmenting the browser experience. For example, analyzing the pages the user is browsing and highlighting text. Chrome exposes several awesome APIs related to the browser and the browsing experience. However, it's just JavaScript, CSS and HTML, so it's definitely possible to take it a step further and create pretty much fully functional applications. However, there are no UI specific features in the Extension API that would make it easier to create a complex web app. 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 allows you to develop a full blown desktop application using HTML, CSS and JavaScript. You can create complex applications with typical web technologies. This is a fairly new technology, but there's a lot of potential.

  • There is also the slightly confusing concept of a "Chrome App", which is really just a way to package a typical web application (or site) for display in the Chrome Web Store. This is not not really a development technology.

Keep in mind that Chrome Extensions and Packaged Apps are not drop-in UI frameworks for creating web apps. They are specific technologies for augmenting the browser experience and creating desktop-like apps, respectively.

For example, if you are creating Amazon.com you would not create the main website as an Extension or Packaged App. You would probably develop it using a typical web development stack and release it as a typical web site. Then, you might create a Chrome Extension that pops a window down in your Chrome browser and shows your recent orders, or that finds products on the Amazon store as you browse the internet, but you would probably not create the entire site as an extension.

With Packaged Apps you might create a desktop application that interacts with Amazon but this is really just a desktop application.

like image 117
Jude Osborn Avatar answered Oct 08 '22 01:10

Jude Osborn


Yes of course this is possible but what you are making is a web application A chrome extension is literally a extension of chrome(which has to be installed) written in C or C++ (Just using javascript, html and css is possible). The handy thing about a web application is that it can be used (In every browser) without having to instal any extra components.

To be specific google has extensions and apps. With a specific chrome app you can do more than a regular web page. At first people would have to install the app and agree with the terms of use. this done you have more options in javascript which are normally forbidden for a casual webpage.

A extension is meant to add or change functionalities in chrome like adding your own video player extension to play avi or something like that. Not for building a web application.

If I where you just make a regular web application or create a chrome specific Packaged App.

In your case you are creating a private web application. If it is going to be used inside a lan you can just create a intranet and run your webapp there. If it has to be used global over the internet that you should just secure it with a login.

Or build a desktop application.

like image 30
botenvouwer Avatar answered Oct 07 '22 23:10

botenvouwer