I am working on a Flask web application.
To access the contents and functionalities, you need to be logged in.
But, SOMETIMES, right after logging in, instead of loading the full home page, a blank "about:srcdoc" page is loaded.
I put print statements throughout the home routing function, and I now know that this error only happens AFTER return render_template() starts running (after the get request is sent by render_template, according to the command prompt).
base.html:
<html>
<head>
<title>Veritas Annotator</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
{%if session['logged_in']%}
<div><h4><a href="/">Annotator</a> | Logged in as "{{ session['username'] }}" | <a href="/logout">Logout</a></h4></div>
<hr>
{%else%}
<div><h4><a href="/register">Register</a> | <a href="/login">Login</a></h4></div>
<hr>
{%endif%}
{% block content %}{% endblock %}
<style>
body{
margin: 0;
padding: 0;
}
.column{
width: 40%;
padding: 10px;
}
.left{
float: left;
}
.right{
float: right;
}
.row:after {
content: "";
display: table;
clear: both;
}
h4 {
color: black;
text-align: center;
font-family: Arial;
font-size: 20px;
vertical-align: bottom;
}
</style>
</body>
</html>
index.html(shortened for clarity):
{% extends "base.html" %}
{% block content %}
{% if not session['logged_in'] %}
<h4>Please, log in to annotate.</h4>
{% else %}
{% if t1,t2 %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<div class="row" style="width: 100%; height: 80%; min-height: 600px;">
<div class="column left" style="width:50%; position: relative; display: inline-block; margin: 0; border: 0; padding: 0;">
<iframe id="cframe" style="display: block" width="100%" height="100%" srcdoc="{{t1}}"></iframe>
</div>
<div class="column right" style="width:50%; position: relative; display: inline-block; margin: 0; border: 0; padding:0;">
<iframe id="oframe" style="display: block" width="100%" height="100%" srcdoc="{{t2}}"></iframe>
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}
Python snippet(with less variables for clarity):
return render_template('index.html', t1=c_body, t2=o_body)
Where c_body, o_body are both page sources retrieved using selenium's browser.page_source
According to the command prompt, the last thing that happens before that error is (note that this isnt always the http code before the error, sometimes it is code 200 instead of 404):
"GET /api-proxy/-/locale_data/rendr-fe/de-DE/bbd065fad57e0e1eeb40f4f3d5045acf_b8cf454f8216fc48b02d6b403858fbbe2fa3ef36.js HTTP/1.0" 404 -
If anyone understands what that request means or has run into this problem before, I would greatly appreciate your assistance. I have been looking online for a couple of days now, but I can't seem to find any sources explaining what is happening.
EDIT1: Full code here => https://github.com/MohamedMoustafaNUIG/AnnotatorVM
EDIT2: If you think I should include some other piece of information in the question please feel free to mention it (even if you don't know a solution). Without solving this problem, the app isn't stable enough for release meaning 3+ weeks worth of effort goes down the drain.
EDIT3: The html of the "about:srcdoc" page that is opened:
<html>
<head></head>
<body></body>
</html>
And there are no console messages (in dev tools)