How to open a URL in a new Tab using JavaScript or jQuery

0 votes

I'm trying to open a URL in a new tab, as opposed to a popup window.

I've seen related questions where the responses would look something like:

window.open(url,'_blank');
window.open(url);

But none of them worked for me, the browser still tried to open a popup window.

Aug 25, 2020 in Java-Script by kartik
• 37,510 points
3,019 views

1 answer to this question.

0 votes

Hello @kartik,

Use window.open():

var win = window.open('http://edureka.co/', '_blank');
if (win) {
    //Browser has allowed it to be opened
    win.focus();
} else {
    //Browser has blocked it
    alert('Please allow popups for this website');
}

Depending on the browsers implementation this will work

Hope it works!!

If not then its recommended to join our Java training class and learn about Java in detail.

Thank you!!

answered Aug 25, 2020 by Niroj
• 82,720 points

Related Questions In Java-Script

0 votes
1 answer

How to send data in request body with a GET when using jQuery $.ajax()?

Hello @kartik, Sending the data in your scenario,I ...READ MORE

answered Jun 18, 2020 in Java-Script by Niroj
• 82,720 points
12,432 views
0 votes
2 answers
0 votes
1 answer

Open a URL in a new tab (and not a new window)

Nothing an author can do can choose ...READ MORE

answered Feb 23 in Java-Script by Aditya
• 7,280 points
101 views
0 votes
1 answer

How can we access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?>

Hello @kartik, You can also use json_encode for ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,720 points

edited Oct 7, 2021 by Sarfaraz 6,109 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,720 points
13,800 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,720 points
1,555 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,720 points
1,275 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,720 points
18,144 views
0 votes
1 answer

How to open the newly created image in a new tab?

Hello @kartik, You can try something like: success: function ...READ MORE

answered Jun 19, 2020 in Java-Script by Niroj
• 82,720 points
4,838 views
+1 vote
1 answer

How can we send message multiple time to a specific person or group in whatsapp using loop?

Hii @kartik,  This is simple task to send single ...READ MORE

answered Feb 28, 2020 in Java-Script by Niroj
• 82,720 points
5,449 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP