Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi committed Feb 7, 2024
1 parent 9babf50 commit 73af8dd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,45 @@ const { response } = await hcaptcha.execute({ async: true });
| `reportapi` | String | No | `-` | See enterprise docs. |
| `sentry` | Boolean | No | `-` | See enterprise docs. |
| `custom` | Boolean | No | `-` | See enterprise docs. |

### ES5 Support

To use in ES5 environments, add the following:

1. **polyfills.js**: This script provides polyfills for features not supported in older browsers.

```html
<script type="text/javascript" src="./node_modules/@hcaptcha/loader/dist/polyfills.js"></script>
```

2. **index.es5.js**: This is the main script file for the `@hcaptcha/loader` package, compiled for ES5 environments.

```html
<script type="text/javascript" src="./node_modules/@hcaptcha/loader/dist/index.es5.js"></script>
```


Once you have included the necessary dependencies, you can use the `@hcaptcha/loader` package in your JavaScript code.

```html
<!DOCTYPE html>
<head>
<script type="text/javascript" src="./node_modules/@hcaptcha/loader/dist/polyfills.js"></script>
<script type="text/javascript" src="./node_modules/@hcaptcha/loader/dist/index.es5.js"></script>
</head>
<body>
<div id="h-captcha" data-sitekey="YOUR_SITE_KEY"></div>
<script type="text/javascript">
var element = document.createElement('div');
window.hcaptcha.render(element, {
sitekey: 'YOUR_SITE_KEY',
// Additional options here
});
</script>
</body>
</html>
```

#### Important Notes

- Ensure that the paths to the script files (`polyfills.js` and `index.es5.js`) are correct relative to your HTML file.

0 comments on commit 73af8dd

Please sign in to comment.