document.addEventListener('DOMContentLoaded', function() { var toggleButton = document.getElementById('toggleButton'); chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) { var tab = tabs[0]; var url = tab.url; toggleButton.addEventListener('click', function() { chrome.tabs.update(tab.id, { url: 'chrome://flags/#enable-force-dark' }); }); }); });