Question

I am new to Django. I want to ask a basic question.

I have an anchor tag in the template

<a href="www.abc.com">website</a>

when I get the rendered template in the webpage, I get an url like this:

www.mydomain.com/my_current_page/www.abc.com

and actually it goes to the same url, while in html I can only find the href to be equal to:

www.abc.com

I also added target=_blank to open in the new page. Is this fine the way I am doing this?

Was it helpful?

Solution

You'll need to declare the anchor like this:

<a href="http://www.abc.com">website</a>

Otherwise the browser will interpret it like a relative url and will happen what you just explained.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top