Reading list Switch to dark mode

    Solution: Open a link in a new tab from a page loaded on Ajax.

    Updated 28 February 2020

    I have faced a problem many times that “_blank” doesn’t work sometimes to open a link new tab and at that time I always run for the solution.

    I have also faced a problem when I was trying to open a link in a new tab while the content was loading dynamically through the AJAX request for a particular part of a complete page. The link was not opening on the new page.

    So here I got the solution for this

    Selection_252

    Here javascript:void(0) prevents the page to open a link on the same page and it even stops the page from reloading on clicking on the link.

    if we use only window.open(‘link’, ‘_blank’); the page will open in the new tab but the current page will reload at the same time, which is not good in practice.

    Start your headless eCommerce
    now.
    Find out More

    In case you have any queries then feel free to ask in the comment section below.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home