> For the complete documentation index, see [llms.txt](https://atd-dts.gitbook.io/atd-knack-operations/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atd-dts.gitbook.io/atd-knack-operations/knack-code/functionality/redirect-blank-pages.md).

# Redirect Blank Menu Pages

How to redirect blank pages as a result of selecting a navigation menu item

![Blank page resulting from selecting a menu item](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MXcMAw-nnlamLDlK3jl%2F-MXcYn7LaTfkBYP5mmLs%2Fimage.png?alt=media\&token=ba505930-13f0-4f79-8b3a-bd48803d588e)

Another great example of this in practice is the Knack Directory in DTS Portal where each app has a blank page that redirects to its respective app's home page url.

### The JS

We create a handler that renders on a specified page scene and redirects the page to the specified url (our first top level page in the menu)

Option A (standard redirect)

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript">/**************************************/
/*** Redirect from Blank Menu Pages ***/
/**************************************/
//Menu Page
$(document).on('knack-scene-render.scene_28', function(event, scene) { 
<strong>window.location.href = "https://atd.knack.com/development-services#development-reviews/";
</strong>});
</code></pre>

Option B (allows the user to go back in the browser after being redirected)

```javascript
/**************************************/
/*** Redirect from Blank Menu Pages ***/
/**************************************/
//Menu Page
$(document).on('knack-scene-render.scene_28', function(event, scene) { 
window.location.replace("https://atd.knack.com/development-services#development-reviews/");
});
```

Option C (redirects from a root url - the first page in your page hierarchy. Used for Customer Portals)

```javascript
/***********************************/
/*** Redirect from Root URL Page ***/
/***********************************/
$(function() { // Execute on page load
  if (window.location.hash === '') {
    window.location.href = "https://atd.knack.com/development-services#customer-portal";
  }

  $(window).on('hashchange', function() {
    if (window.location.hash === '') {
      window.location.href = "https://atd.knack.com/development-services#customer-portal";
    }
  });
});
```

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FKnLsmfHDelbjhx9ZfhQr%2Fimage.png?alt=media&amp;token=c5a9e256-f1ed-4bf0-b00b-d2b34b46c1d8" alt=""><figcaption></figcaption></figure>

### The CSS

None needed 😎

### How to Implement

Adjust the Scene ID

```
'knack-scene-render.scene_28'
```

and the URL

```
window.location.href = "https://atd.knack.com/development-services#development-reviews/"
```
