How to get the browser to navigate to URL in JavaScript?

0 votes
What is the best way to get a web browser to navigate to a URL of your choice using JavaScript?
May 28 in Java-Script by kartik
• 30,630 points
139 views

1 answer to this question.

0 votes

Hii,

This works in all browsers:

window.location.href = '...';

If you wanted to change the page without it reflecting in the browser back history, you can do:

window.location.replace('...');

Hope this is helpfull!

answered May 28 by Niroj
• 66,420 points

Related Questions In Java-Script

0 votes
1 answer

How to get the host url using javascript from the current page?

Hello @kartik, Use: var host = window.location.hostname; or possibly var host ...READ MORE

answered Oct 9 in Java-Script by Niroj
• 66,420 points
32 views
0 votes
1 answer

How to detect if URL has changed after hash in JavaScript?

Hello @kartik, Use this code window.onhashchange = function() { ...READ MORE

answered Jun 17 in Java-Script by Niroj
• 66,420 points
416 views
0 votes
1 answer

How to decode the url in php where url is encoded with encodeURIComponent()?

Hello @kartik, Use this function: <?php $string = 'http%3A%2F%2Fexample.com'; $output = ...READ MORE

answered Jul 7 in Java-Script by Niroj
• 66,420 points
338 views
0 votes
1 answer

How to trigger the window resize event in JavaScript?

Hello @kartik, Try this: window.dispatchEvent(new Event('resize') ...READ MORE

answered Aug 25 in Java-Script by Niroj
• 66,420 points
84 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 in Laravel by Niroj
• 66,420 points
2,715 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18 in Laravel by Niroj
• 66,420 points
329 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23 in Laravel by Niroj
• 66,420 points
221 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 in Laravel by Niroj
• 66,420 points
3,364 views
0 votes
1 answer

How to get the URL without any parameters in JavaScript?

Hello @kartik, This is possible, but you'll have ...READ MORE

answered Oct 9 in Java-Script by Niroj
• 66,420 points
19 views
0 votes
1 answer

How to get the current URL with JavaScript?

Hello @kartik, Use: window.location.href As noted in the comments, ...READ MORE

answered Aug 28 in Java-Script by Niroj
• 66,420 points
58 views