How to disable hardware back button for a specific page only

Hello guys , i am having issue with how to disable the back-button hardware. i only want it to work on the homepage of my app and not other pages. it works well when you are on the homepage but also works on every other page that opens. i want users to be able to use the back button on all the pages except the homepage.
This is my code

     this.subscribe = this.platform.backButton.subscribeWithPriority(666666,()=>{
     if ( == "HomePage") {
       if (window.confirm("Do you want to exit app")) {

Never write any code that relies on names of JavaScript identifiers as strings. It will break in production. Move this subscription into the page you care about, and unsubscribe when leaving it.

1 Like

Okay. Thanks. I will take note of that