开发者

Using An Iframe for an embedded App

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

    <iframe 
     src="App.myurl.com/Application.php?width=200&height=300" 
     width="200" 
     height="300" >
         <p>your browser does not support iframes</p>
    </iframe>

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜