I made a thank you page to redirect clients after

Hello,
I made a thank you page to redirect clients after scheduling a non-payment appointment.
When I add the suggested code to my functions.php file then I get a broken site. I replaced the URL with my confirmation page URL.
function app_redirect( $script ){
return str_replace("window.location.href=app_location()", "window.location.target='_blank' href='http://example.com'", $script);
}
add_filter( 'app_footer_scripts', 'app_redirect' );

Is this code out of date or is something else going on?
Thank you.