As well as the basic way of including the GrabzIt's JavaScript library via a normal script tag. GrabzIt can also be included as a ES 6 module. In the below example we are going to create a module and then import GrabzIt into it.
<html> <head> <script type="module" src="main.js"></script> </head> <body> </body> </html>
First download the GrabzIt's JavaScript library. Then create a file called main.js
. Next get the grabzit.min.mjs
file and from this import GrabzIt as a module, as shown in the example below.
import GrabzIt from '/grabzit.min.mjs'
GrabzIt('Sign in to view your Application Key').ConvertURL("https://www.bbc.com").Create();
Note that your web server may need to be configured to serve .mjs
files with the standard mime type of text/javascript
. If this is a problem just rename the file to .js
instead.
Once GrabzIt is imported into your module you can use the JavaScript API as you usually would.