Loading a webpage into iFrame Flask [duplicate] Loading a webpage into iFrame Flask [duplicate] flask flask

Loading a webpage into iFrame Flask [duplicate]


You're referencing the main.html template from index.html which are in the same directory, try using src="main.html" in iFrame.

Then the browser will be sending another GET Request for the main.html file. You need to cover it from the server side by adding the new function in your Flask server:

from flask import Flask, render_templateapp = Flask(__name__)@app.route('/')def hello(name=None):    return render_template('index.html', name=name)@app.route('/main.html')def main():    return render_template('main.html')if __name__ == '__main__':    app.run()