0

I'm trying to write an jsp application using apache tomcat server. I need a button's onclick to redirect to google. When I give -

onclick="window.open('www.google.com');"

It opens a new window with

http://localhost:8080/LiveSearch/www.google.com

How do I make it open a window with just 'www.google.com' as url?

sudha
  • 93
  • 2
  • 7
  • Possible duplicate of [How to redirect to another webpage?](https://stackoverflow.com/questions/503093/how-to-redirect-to-another-webpage) – Olaf Kock Sep 20 '17 at 06:52

1 Answers1

1

You could use window.location.href = "https://www.google.com";. This will act as if you were simply opening a new URL.

jdhurricanes
  • 142
  • 9
  • I actually tried that before opening a new window. That too redirected to the same url I mentiones above. – sudha Sep 19 '17 at 15:57