Can you check the internet protocol from Django's template?

Viewed 19067

Right now, if I want to check whether the current page is accessed through http:// or https://, I will use the following Javascript in my templates and write html from document.write:

<script type="text/javascript">
var protocol = document.location.protocol;
if (protocol == "http:")
    document.write("regular");
else
    document.write("secured");
</script>

Is there another way to achieve the above in Django's template without using Javascript?

4 Answers
Related