Home > Blockchain >  How to redirect any website by clicking an image in html where framework is Django?
How to redirect any website by clicking an image in html where framework is Django?

Time:01-23

Sample Image

Here, I want to redirect www.facebook.com if I click that Facebook logo but as I have a port number of 127.0.0.1:8000 therefore after clicking the image I'm redirecting http://127.0.0.1:8000/www.facebook.com and for that I'm getting Page Not Found(404) Error How can I fix this so that it will only redirect fb or insta?

  <ul >
          <li ><a  href="www.facebook.com"><img src="/static/fb.png"></a></li>
          <li ><a  href="www.instagram.com"><img src="/static/insta.png"></a></li>
          <li ><a  href="www.twitter.com"><img src="/static/twitter.jpg"></a></li>
  </ul>

CodePudding user response:

This is probably because HTML thinks you want to redirect to a sub directory or something. Instead your href should include a https:// before the domain, for example:

<a href="https://www.facebook.com"><img src="/static/fb.png"></a>
  •  Tags:  
  • Related