Redirect to a custom page on any WebProd error using pure JavaScript

Redirect to a custom page on any WebProd error using pure JavaScript

Summary This article demonstrates how and where to insert JavaScript so you can forward your respondents to a specific URL when any WebProd error is generated
Applies to web ; webprod ; askiaweb
Written for  Project Managers ; Script Writers
Keywords web ; webprod ; askiaext.dll ; redirect ; error ; java ; script ; javascript

This article will demonstrate how to forward your respondents to a specific URL for any WebProd error.

This is slightly different than this article, which shows how to forward respondents to a static .htm file you design, based on a specific WebProd error.

For your reference, please see this link that lists all available WebProd error codes and their meanings.


The script:

<div>Error: ??WEBPROD_ERROR??.</div><script>window.addEventListener('DOMContentLoaded', (event) => {window.location.replace("");});</script>


The where:

The above script can be inserted into one of two locations:

1) via the "Webprod configuration" section in the WebProd Administrator interface via URL:

Login with your administrator credentials, click on the "Configuration" tab on the top-right of the page, expand the "WebProd configuration" section, and then look for the "General Error Page" input box.


Paste your script string into this input box and then hit the "Submit" button at the bottom of the page to save.


2) via the "HtmlGeneralErrorPage" column in the "WP_Const" table in the "WebProd" database.

Simple SELECT query:

SELECT HtmlGeneralErrorPage FROM [WebProd].[dbo].[WP_Const]

In SSMS (SQL Server Management Studio), you should be able to edit that table and then paste in the script.



Please note: regardless if you insert it into the WebProd interface, or directly in SQL, the script needs to be "minified" to fit on a single line. Do not try to split the code into multiple lines.


Attention: once you've inserted the script, you will need to restart the WebProdAppPool in IIS for your changes to take effect.


That's it. Now any time a general error is produced by WebProd for any survey, the initial error message will show up on the screen for a split moment, and then the JavaScript will forward your respondent to whatever URL you designated.

You can test this on your server by replicating a "1003" error, simply by not providing enough parameters on the survey URL (e.g.

Have more questions? Submit a request