diff --git a/renderer/script.js b/renderer/script.js index 076b352..c6fce8b 100644 --- a/renderer/script.js +++ b/renderer/script.js @@ -90,34 +90,41 @@ function createTab(inputUrl) { console.log('[DEBUG] createTab() inputUrl =', inputUrl); const id = crypto.randomUUID(); - // Handle home page specially - if (inputUrl === 'browser://home') { - // Show home container and hide webviews - const homeContainer = document.getElementById('home-container'); - const webviewsEl = document.getElementById('webviews'); - if (homeContainer) homeContainer.classList.add('active'); - if (webviewsEl) webviewsEl.classList.add('hidden'); - const tab = { - id, - url: inputUrl, - title: 'New Tab', - favicon: '', - history: [inputUrl], - historyIndex: 0, - isHome: true - }; - tabs.push(tab); - setActiveTab(id); - // Render the tab bar so the new home tab appears - renderTabs(); - return id; - } + // Handle home page specially + if (inputUrl === 'browser://home') { + // Show home container and hide webviews + const homeContainer = document.getElementById('home-container'); + const webviewsEl = document.getElementById('webviews'); + if (homeContainer) homeContainer.classList.add('active'); + if (webviewsEl) webviewsEl.classList.add('hidden'); + const tab = { + id, + url: inputUrl, + title: 'New Tab', + favicon: '', + history: [inputUrl], + historyIndex: 0, + isHome: true + }; + tabs.push(tab); + setActiveTab(id); + // Render the tab bar so the new home tab appears + renderTabs(); + return id; + } // For all other URLs, use webview const resolvedUrl = resolveInternalUrl(inputUrl); console.log('[DEBUG] createTab() resolvedUrl =', resolvedUrl); const webview = document.createElement('webview'); + // give the webview an id and set its source and attributes so it actually loads and can be managed + webview.id = `tab-${id}`; + webview.src = resolvedUrl; + webview.setAttribute('allowpopups', ''); + webview.setAttribute('partition', 'persist:default'); + webview.setAttribute('preload', '../preload.js'); + webview.addEventListener('page-favicon-updated', e => { if (e.favicons.length > 0) updateTabMetadata(id, 'favicon', e.favicons[0]); }); diff --git a/site-history.json b/site-history.json index 53389b7..fc51572 100644 --- a/site-history.json +++ b/site-history.json @@ -1,7 +1,12 @@ [ + "https://duckduckgo.com/?q=dogs&ia=web", + "https://duckduckgo.com/?q=dogs", + "https://www.bing.com/search?q=dogs", + "https://www.google.com/search?q=cats", "https://www.youtube.com/", "https://github.com/", "file:///X:/Projects/Code/NebulaBrowser/renderer/index.html", + "file:///X:/Projects/Code/NebulaBrowser/renderer/index.html", "https://youtube.com/", "file:///X:/Projects/Code/NebulaBrowser/renderer/index.html", "https://youtube.com/",