// var bm = new BroadcastChannel('testchannel'); // if(…
- User
//
var bm = new BroadcastChannel('test_channel'); // if( (document.getElementById('authlog').name=='logout') ) { var page_ba='logged_in'; bm.postMessage('logged_in'); document.getElementById('authlog').addEventListener('submit', (event) => { event.preventDefault(); if (window.confirm("if there are changes on other tabs, entered data would be lost, confirm logout anyway") ) { document.getElementById('authlog').submit(); } }); } if( (document.getElementById('authlog').name=='login') ) { bm.postMessage('logged_out'); var page_ba='logged_out'; } console.log('page loaded page_ba:'+page_ba); // bm.onmessage = (message) => { console.log('message.data:'+message.data); if( (message.data=='logged_in')||(message.data=='logged_out') ) { if(page_ba!==message.data) { console.log('page_ba:'+page_ba);
console.log('login changed on other tab, '); console.log('reloading page in current tab');
console.log(location.pathname+location.search); location.replace(location.pathname+location.search); } } } Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.