-
MathType
-
WirisQuizzes
-
Nubric
-
CalcMe
-
MathPlayer
-
Store FAQ
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Configure WIRISplugins.js
Reading time: 3minConfigure WIRISplugins.js to render MathType formulas when displaying content outside the editor. When formulas are stored as MathML, some browsers or applications may not display them with the expected quality or accessibility features. WIRISplugins.js processes the formulas in the page and renders them according to the configured viewer options.
After completing this guide, MathType formulas will be rendered correctly when your content is displayed.
Before you begin
Requirements
Make sure you have:
- A MathType integration version 3.50 or later.
- Access to the HTML page or template where formulas are displayed.
- Access to the
WIRISplugins.jsfile provided by your deployment.
Applies to
Pages that display MathType formulas outside the editor · Integrations using Full MathML mode.
Steps
Add WIRISplugins.js to the page
Add WIRISplugins.js to the page where MathType formulas are displayed.
PHP and .NET
For PHP and .NET integrations, use the script from the integration directory:
<script src="<your-plugin>/integration/WIRISplugins.js?viewer=image"></script>Java
For Java integrations, use the script from the Integration Services application path:
<script src="<pluginwiris-engine-path>/app/WIRISplugins.js?viewer=image"></script>Cloud deployment
If you're using a JavaScript-only frontend without self-hosted MathType Integration Services, you can load the viewer from the WIRIS-hosted services:
<script src="https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image"></script>Configure viewer parameters
You can configure WIRISplugins.js using URL parameters. For example, to render formulas as images:
<script src="WIRISplugins.js?viewer=image"></script>To set the language used for accessible text:
<script src="WIRISplugins.js?viewer=image&lang=en"></script>To render formulas asynchronously:
<script src="WIRISplugins.js?viewer=image&async=true"></script>Common parameters include:
| Parameter | Purpose |
|---|---|
viewer |
Defines how formulas are displayed. |
lang |
Defines the language used for accessible text. |
dpi |
Defines the image resolution used when rendering formulas. |
async |
Defines whether formulas are rendered asynchronously. |
For the complete list of parameters, supported values, and defaults, see WIRISplugins.js parameters.
Render formulas inside a specific DOM element
By default, WIRISplugins.js processes the formulas in the page where it is loaded. If your application loads content dynamically, apply the viewer to a specific DOM element after the content has been inserted into the page:
com.wiris.js.JsPluginViewer.parseElement(
domElement,
true,
function() {}
);Use this approach when formulas are added after the initial page load, for example in single-page applications or dynamically rendered content blocks.
Apply the configuration
Save the page or template where WIRISplugins.js is included. If your application bundles frontend assets, rebuild or redeploy the application if required.
Verify the configuration
Open a page that contains MathType formulas and verify that WIRISplugins.js is loaded by the browser. Use your browser's developer tools to confirm that:
- The script is loaded successfully.
- The configured URL parameters are present.
- No JavaScript errors are reported.
Verify it worked
Open a page that displays MathType formulas. Confirm that:
- Formulas are rendered correctly.
- Formulas include accessible text when rendered as images.
- Dynamically loaded formulas are rendered after calling
parseElement, if applicable.
Options and variations
PHP and .NET deployments
Load WIRISplugins.js from your PHP or .NET Integration Services deployment.
Java deployments
Load WIRISplugins.js from your Java Integration Services deployment.
Cloud deployments
If you are using the WIRIS cloud services without self-hosted Integration Services, load WIRISplugins.js directly from the WIRIS cloud endpoint.
Render dynamically inserted content
If formulas are added to the page after it has loaded (for example, through AJAX or client-side rendering), render only the affected DOM element instead of the entire page. Use:
com.wiris.js.JsPluginViewer.parseElement(domElement, true, function(){});Common issues
Formulas are not rendered
Verify that:
-
WIRISplugins.jsis included on the page. - The script path matches your deployment.
- The
viewerparameter is configured correctly. - The page contains valid MathType formula markup.
Dynamically loaded formulas are not rendered
Verify that:
-
parseElementis called after the content has been added to the DOM. - The correct DOM element is passed to
parseElement. - No JavaScript errors occur before the viewer is applied.
The script cannot be loaded
Verify that:
- The script URL is correct for your deployment.
- The browser can access the script without network errors.
- Cross-domain requests are configured if the script is loaded from another origin.