Javascript in version filter does not redirect on 404

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets

Javascript in version filter does not redirect on 404

Postby Giri on Tue Apr 30, 2019 1:58 am

We have developed a HTML5 - TopNav product documentation site by using Madcap Flare 2018r2. Here is the site: We use bit bucket repositories to commit all our projects from Flare.

Some of the products have product doc versions. In bit bucket, each product doc version is a separate repository. We have a common landing page (, which is also in a bit bucket repository (an individual Flare project).

When users go to any doc site and read a topic, they have the option to switch to another product doc version. This is done from the version filter drop down at the top right. If a matching file is found in the other product doc version -- no issues. However, if a matching html file is not found in another documentation version, the JavaScript that loads the version filter should pop up an alert instead of the 404 page. This is the problem that I am trying to solve - instead of displaying the 404.htm, I need the .js file to provide users with options.

The "top level" Flare project (the one for the landing page) has a versionfilter.js that takes the reader to another topic in another doc version (if the user selects it from the drop down). The versions and parameters are defined in a config.json in the same Flare project.

In each of the product docs (for example a snippet is defined that calls the config.json in the top level Flare project, which in turn reads the versionfilter.js.

This works fine ... try to select different pages and navigate between the versions (for example -

However, when a matching file is not found in the other version (for example a 404 page is loaded.

I took the help of a developer and tried to add an Ajax call in the versionfilter.js to redirect when a page is not found. But this is not working.

We use IIS as the production server.

Is there someone who can help?

Here is the content of the snippet file (unable to attach it so pasting the contents here):
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:MadCap="">
<div id="filterVersion"></div>
$(document).ready(function() {
new VersionFilter({project: "ws"});
The config.json file:

"ida": {
"versions": ["9_5", "9_2"],
"default": "9_5"
"idc": {
"versions": ["9_5", "9_2", "9_0"],
"default": "9_5"
"ws": {
"versions": ["10_2", "10_0"],
"default": "10_2"



In the attached versionfilter,js, I added this:

type: "get",
url: url,
cache: false,
statusCode: {
404: function ()
alert('page not found');
200: function ()
window.location.href = url;
async: false

But I still get a "versionFilter not defined" in Chrome Developer tools > Error checker.

You do not have the required permissions to view the files attached to this post.
Jr. Propeller Head
Posts: 3
Joined: Fri Apr 26, 2019 11:22 pm

Re: Javascript in version filter does not redirect on 404

Postby amitkapoor on Mon Sep 16, 2019 5:25 am

Hi Giri,

How did you solve the issue if you could share it with us?

Propeller Head
Posts: 16
Joined: Mon Sep 16, 2019 5:23 am

Return to Web-based Outputs

Who is online

Users browsing this forum: No registered users and 7 guests