Menu Close
    Hire us Request quote Reading list Switch to dark mode

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

    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

    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.

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .

    if we use only‘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.

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

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again