Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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 class="nav col-md-4 justify-content-end list-unstyled d-flex">
          <li class="ms-3"><a class="text-muted" href="www.facebook.com"><img src="/static/fb.png"></a></li>
          <li class="ms-3"><a class="text-muted" href="www.instagram.com"><img src="/static/insta.png"></a></li>
          <li class="ms-3"><a class="text-muted" href="www.twitter.com"><img src="/static/twitter.jpg"></a></li>
  </ul>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading