Welcome Guest, Not a member yet? Register   Sign In
trying to open a new tab in the browser
#2

where is the function that will trigger the JS ?

I think it should be like this
Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home</title>
</head>
<body>
    <button onclick="openTab()" type="button" class="btn btn-primary">Primary</button>

    <script>
        function openTab() {
            window.open('https://duckduckgo.com/?t=ffab', '_blank');
        }
    </script>
</body>
</html>

here the openTab() function will trigger whats inside it when called via the onclick attribute. You just echoed the window.open line , i dont think this will work.
Increase Your Awareness
Reply


Messages In This Thread
RE: trying to open a new tab in the browser - by BlackBanana - 07-18-2020, 02:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB