question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to open new page in selected tab

See original GitHub issue

Hello, when I want to open a new page in a tab, I don’t see anything, is there something wrong with my code?

Below is my code index.html file

<div class="etabs-tabgroup">
  <div class="etabs-tabs"></div>
   <div class="etabs-buttons"></div>
 </div>
<div class="etabs-views"></div>
<script>
    require('./renderer.js')
</script>

renderer.js file

const TabGroup = require("electron-tabs");
let tabGroup = new TabGroup();
 tabGroup.addTab({
    title: "server",
    src: "./demo.html",
    active: true,
    closable:false,
})

demo.html file

<body>
    <a onClick="window.open('http://www.baidu.com')">click me</a>
</body>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
MCMicScommented, Apr 13, 2022

Hi, you can addEventListener for close event to the webview and then close the tab.

const tab = tabGroup.addTab(
    title: "Electron",
    src: "./demo.html",
    visible: true,
    active: true,
    webviewAttributes: {
        allowpopups: true,
        id:'foo',
    }
});
tab.webview.addEventListener('close', () => t.close())
2reactions
puchenhuicommented, Apr 12, 2022

You have been amazing, solved all my problems, I have no problems now, thank you for your very patient guidance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to open new tab in browser? - javascript - Stack Overflow
@laaposto's answer worked for me. But this is because my browser is set to open in a new tab, not a new window....
Read more >
Open in new tab or window not working - Browsers
If the navigation attempt is stopped, the new tab or window can be navigated by providing the address into the appropriate address bar....
Read more >
How to Force Your Browser to Open a Link in a New Tab
Mozilla Firefox ; Options page in Firefox, select the ; General tab, and check the box next to ; Open links in tabs...
Read more >
chrome.tabs - Chrome Developers
A common pattern for extensions is to open an onboarding page in a new tab when the extension is installed. The following example...
Read more >
Why do some sites not let you open links in new tabs? - Quora
By forcing users to not be able to open into another window or tab, you keep the user on your platform for longer,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found