I want to create a single html page i.e. download link. How can I embed an image in the background of that page? When I visit the page, that is, when I enter the link, I want it to be automatically saved directly in the ‘C/users’ folder of my computer, for example. When I enter that link, I want the image file to be saved, opened and displayed in the C/users folder using python. How do I embed python code in html page for this? So how can I get that python code to run automatically when I enter or visit the html download link?How to use python for this and how can it be embedded in the html page? So the short of the long question is that when I enter the html download link, I want the image file to be automatically saved in a folder, opened and displayed directly using python.
How do I use python in this and place it in the html download link and get it run automatically? Can you write me long and detailed answers?
2
Answers
Fortunately that’s not possible, for many reasons, security being the most important. If browsers allow you to execute arbitrary code, that would be an open door to many viruses and malware. As a general rule for new questions about browsers and webpages, if something can be dangerous for the user, generally it will not be possible to do it in a web browser.
If you want to run python code "inside" a website, you can use php to execute python code on the server and give the result back to show on the html website. html -> php -> python -> php -> html
I made a small example for this, hope it helps a bit: http://www.terragon.de/kuenstliche-intelligenz/python-tutorials/python-in-php-ausfuehren/