JavaScript to redirect specific page


I have a dropdown menu in our database, but unfortunately, when you click on the actual dropdown title, it leads to a blank page. There seems to be no way to edit that page, so I want to redirect it to the first page in the dropdown.

I'm really not good with JavaScript, but this is what I have so far:


$(document).on('knack-scene-render.scene_809', function(event, scene) {
if (window.location.hash.indexof("#resume-builder") != -1) {
else {}


Any ideas why the above doesn't work? I've tried a bunch of variations, but this seems to be as far as I can get. Thank you in advance!

In case anyone is interested, 380030416312 posted the correct code here:


$(document).on('knack-scene-render.scene_284', function(event, scene) { 
window.location.href = "https://......";

Replace 'scene_284' with the scene number of your drop-down menu and add your redirect URL.


It worked beautifully for me. 


It’s better than using window.location.href = ‘’;

Using replace() is better because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.

If you want to simulate someone clicking on a link, use window.location.href

If you want to simulate an HTTP redirect, use window.location.replace

You can use assign() and replace methods also to JavaScript redirect to other pages like the following:


The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.

1 Like