-3

Below is the code

<a href="www.yahoo.com" target="_blank">Yahoo!</a>

it's display next page url like below

http://99.1.0.39/test/test-2/www.yahoo.com

How to open new page with www.yahoo.com?

user3942918
  • 25,539
  • 11
  • 55
  • 67
Siva Unique
  • 189
  • 2
  • 17
  • 3
    https : // www.yahoo.com – Roy Bogado Jul 17 '18 at 07:15
  • Can you please tell me why we will put like that https:// – Siva Unique Jul 17 '18 at 07:19
  • www also valid right. @Roy please help me on this – Siva Unique Jul 17 '18 at 07:19
  • The browser doesn't know that "www..." is *supposed* to represent a domain. What's the difference between `www.yahoo.com` and `foobar`? `foobar` is interpreted as a relative path, i.e. the "directory" `foobar`. What's different about `www.yahoo.com` that it should not be interpreted the same way? Nothing. You need a fully qualified URL to external domains, not just the host name. – deceze Jul 17 '18 at 07:23
  • I helped, use correct absolute path.. (best way is going to the site yahoo.com, copy the entire url and paste on href) – Roy Bogado Jul 17 '18 at 07:23
  • ok @roy,@deceze , always we have to give http:// or https:// right – Siva Unique Jul 17 '18 at 07:27
  • Does this answer your question? [HTML force URL hyperlink to be treated as non-relative (absolute)](https://stackoverflow.com/questions/9215162/html-force-url-hyperlink-to-be-treated-as-non-relative-absolute) – Sebastian Simon Mar 04 '22 at 18:34

1 Answers1

1

Try using

If you are unsure about that protocol use

<a href="//www.yahoo.com" target="_blank">Yahoo!</a>

or

<a href="https://www.yahoo.com" target="_blank">Yahoo!</a>

or

<a href="http://www.yahoo.com" target="_blank">Yahoo!</a>
Ajmal PraveeN
  • 414
  • 8
  • 16