Ad
HTML Link Not Going To External Site
I have been running a localhost website with react.js while I am building a website and when I am trying to link to an external site (e.g. youtube) it ends up going to a link like this:
http://localhost:3000/www.youtube.com
while I am trying to go to:
I am using this to get my link:
<a href='youtube.com' target='_blank' rel='noreferrer'>YouTube</a>
Ad
Answer
You need to specify the protocol, or put // at the start of the href attribute. For example: Try using a protocol like http:// or // to external links like this :
<a href='https://youtube.com' target='_blank' rel='noreferrer'>YouTube</a>
See this good answer on SO : https://stackoverflow.com/a/8951636/6028607
Ad
source: stackoverflow.com
Related Questions
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → laravel blade templating error
- → should I choose reactjs+f7 or f7+vue.js?
- → How to dynamically add class to parent div of focused input field?
- → Setting the maxlength of text in an element that is displayed
- → Undefined Result for Variable with Javascript innerHTML function
- → Expanding search bar not expanding before search
- → Get the calling element with vue.js
- → Blade: how to include a section in one page but not in another
- → How to print/log reactjs rendered dom?
- → how to write react component to construct HTML DOM
- → How to add a timer in HTML5 and Javascript?
Ad