$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Side effects of Script and Iframe in post|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Side effects of Script and Iframe in post

matteradmin9PV0评论

I am writing a post on HTML. Afcorse the post will have Codes in it. So for showing results in the post, I am taking help of JSFiddle, by embedding results of the code.

JSFiddle gives two methods for embedding results:

Script

<script async src="//jsfiddle/o7usdL0a/embed/result/"></script>

IFrame

<iframe width="100%" height="300" src="//jsfiddle/o7usdL0a/embedded/result/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe>

My question is which method should be recommended for embedding results? (Script/IFrame)? Why?

Does any of the above method affect my site performance?

Is there any other alternative method/plugin which will be more fast and better than the above two methods?

I am writing a post on HTML. Afcorse the post will have Codes in it. So for showing results in the post, I am taking help of JSFiddle, by embedding results of the code.

JSFiddle gives two methods for embedding results:

Script

<script async src="//jsfiddle/o7usdL0a/embed/result/"></script>

IFrame

<iframe width="100%" height="300" src="//jsfiddle/o7usdL0a/embedded/result/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe>

My question is which method should be recommended for embedding results? (Script/IFrame)? Why?

Does any of the above method affect my site performance?

Is there any other alternative method/plugin which will be more fast and better than the above two methods?

Share Improve this question edited Dec 2, 2018 at 6:33 nitasot asked Dec 1, 2018 at 18:08 nitasotnitasot 112 bronze badges 3
  • Welcome to WPSE. You may need to edit your question to be more specific. What is the context of adding these? That may make a big difference on what will work best. – butlerblog Commented Dec 1, 2018 at 18:12
  • 1 @butlerblog I edited my question as per the requirements... – nitasot Commented Dec 2, 2018 at 6:34
  • Any updates @butlerblog sir? – nitasot Commented Dec 3, 2018 at 16:07
Add a comment  | 

1 Answer 1

Reset to default 0

The recommended method for embedding iframes is using the <iframe> tag. It makes for better syntax and also allows you to control the iframe much better.

For example, you are able to remove an iframe's border, control scrolling options, etc.

<iframe src="//jsfiddle/o7usdL0a/embed/result/" style="width: 100%; height: 300px"
scrolling="no" marginwidth="0" marginheight="0" frameborder="0">
</iframe>

The <script async> and the <iframe> methods are both the same when it comes to site performance as they are both asynchronous. If you use the tag it will load asynchronously by default, so no need to worry about blocking code.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far