I’m currently programming a web application that can be embedded.
I’m wondering if it would be a good practice to generate an iframe for the interface through an included Javascript file?
For example the user would just have to include this on their index page:
<script src="App.myurl.com/Application.js"/></script>
Init_App("[User_Public_Authorization]");
Application.js will then generate an Iframe that contains PHP code for the application.
Before you write a script you should always ask yourself if you really need it.
What you want to do is load an script which then creates an iframe which then loads your app.
The simpler solution would be to just use an iframe.
Which benefits would you get from your script?
What can your script do that an ordinary iframe can not do?
Use an iframe tag and if you need site-specific parameters put them in the query string
Generating PHP code with javascript is pointless because PHP is executed on the server.
And trust me you should not run code on your server that was generated by a client.