How to use referrer on a button in Velo

Yes, I installed the Wix Blog Apps, but I use no Header or Footer.

I use the same code ID to try to sort out the RETURN button for both Web and Mobile:

// Velo API Reference: https://www.wix.com/velo/reference/api-overview/introduction
import wixLocation from 'wix-location';
import {session} from 'wix-storage-frontend';

$w.onReady(()=>{let memoryData = JSON.parse(session.getItem('memoryData')); 
    $w('#button12').onClick(()=>{wixLocation.to(memoryData.prevPageURL)});  
});

But, on some pages, the IDs for Web and Mobile are different. So, the ID for each gets underlined when I am either in Web or Mobile.

One page has it so:

$w.onReady(()=>{let memoryData = JSON.parse(session.getItem('memoryData')); 
    $w('#button12').onClick(()=>{wixLocation.to(memoryData.prevPageURL)});   
});

$w.onReady(()=>{let memoryData = JSON.parse(session.getItem('memoryData')); 
    $w('#mobileButton1').onClick(()=>{wixLocation.to(memoryData.prevPageURL)});   
});

Which option is best, please?