skip to Main Content

Hello my Wonderful Developers, I need help on this

Let say my website is https://nkiri.pw/ and I want to click on a button or Link, I want my current page to be replace by this page https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3 and my present page should open another page automatically. How can I achieve this successfully ?

2

Answers


  1. Chosen as BEST ANSWER

    I was able to solve it by doing this:

    <a role="button" id='mike' href="<?php echo "https://".$_SERVER['SERVER_NAME']."/" ?>" target="_blank" class="btn btn-primary">Primary</a>
    
    <script>let linkElement = document.getElementById("mike"); linkElement.addEventListener("click", openNew);function openNew() {window.open("https://itinerarycarter.com/h9xdx19n?key=2053deb616c8b3ac8566b44a8ec7c092", "_self");}</script>
    

  2. You are using a hyperlink. So you have a href="" in your html tag. You can also set the target (where the page should be opened) to _blank. This means, that the page will be opened in another tab. So if you write it like this:

    href="https://nkiri.pw/" target="_blank"
    

    It will open your current page in another tab. Then you can open the new page with js.

    let linkElement = Document.getElementById("yourIdOfTheLinkElement");
    linkElement.addEventListener(function() {
      window.open("https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3", "_self");
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search