The callout is activated by ALT + double click
combination.
In order to use the web plugin you'd need to set up a proxy API endpoint, otherwise the web browser would block requests to https://vazhaju.tj because of CORS security constraints.
Web plugin's apiUrl
would have to point at your website's proxy endpoint. The request flow would look like this
web plugin -> your website's search proxy -> web plugin's search API endpoint
How to create a proxy endpoint is described below.
Include this excerpt in your website's HEAD block.
<script src="https://unpkg.com/vazhaju-web-extensions/dist/web-plugin/web-plugin.js"></script>
<link rel="stylesheet" href="https://unpkg.com/vazhaju-web-extensions/dist/web-plugin/web-plugin.css">
<script type="text/javascript">
VazhajuWebPlugin.configure({
apiUrl: '/api/search-proxy',
});
</script>
Install the package.
npm i vazhaju-web-extensions --save
Import the js
and css
assets into your code.
// JavaScript
import VazhajuWebPlugin from 'vazhaju-web-extensions/dist/web-plugin/web-plugin';
VazhajuWebPlugin.configure({
apiUrl: '/api/search-proxy',
});
// Sass / Scss
@import 'vazhaju-web-extensions/dist/web-plugin/web-plugin';
The proxy should forward web plugin's request to https://vazhaju.tj/api/search/web-plugin
.
router.post('/api/search-proxy', async (req, res, next) => {
try {
const response = await axios.post('https://vazhaju.tj/api/search/web-plugin', req.body);
res.json(response.data);
} catch (error) {
next(error);
}
});
- PHP example
- Python example
- C# example