Q1: Session storage is separated by tabs, so it is not possible to operate on sessionStorage of page B from page A. BUT you can use localStorage as a link to control anything from every tab and window, just cleverly use an event listener attached to the storage.
window.addEventListener('storage', function(e) {
console.log(e + ' updated on localStorage');
// Code to modify sessionStorage here
});
Q2: You need to keep track of how many tabs are open, as this is relatively easy, it can lead to errors (all tabs beign closed at once won't trigger the clear), you need to attach an event listener for the close event.
window.addEventListener('unload', function(e) {
console.log(e);
// Code to clear the storage
});