I created a basic Chrome extension that includes a background page with the following code:
<script type="text/javascript>
chrome.tabs.onDetached.addListener(function(tabId, info){
var id = tabId;
chrome.tabs.get(id, function(tab) {
chrome.tabs.create({
windowId : info.oldWindowId,
index : info.oldPosition,
url : tab.url
});
});
});
</script>
This extension allows users to detach a tab from a window without losing the tab or the web address. Essentially, it duplicates the tab when it is detached.
However, I noticed an issue when testing this extension on two different Windows machines. An error message appeared:
background.html:7Uncaught TypeError: Cannot read property 'url' of undefined
It seems like the tab object is not being passed into the get
callback. I'm puzzled as to why this is happening on Windows machines but not on Mac. Any insights on what might be causing this discrepancy?