What is Iframe?
An Iframe also called as Inline frame, is a HTML element that loads another HTML page within the document. It essentially puts another webpage within the parent page. They are commonly used for advertisements, embedded videos, web analytics and interactive content.
Syntax:
<iframe src="URL" title="description"></iframe>
Attributes value: It contains a single value URL that specifies the URL of the document that is embedded in the iframe. There are two types of URL links which are listed below:
Absolute URL: It points to another webpage.
Relative URL: It points to other files of the same web page.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>The iframe element</h1>
<iframe src="https://www.thetechplatform.com/" title="The Tech Platform">
</iframe>
</body>
</html>
Output:
Advantages:
The browser allocates some space for an inline frame beforehand and takes this into account when rendering the document.
Iframes implement the cross domain origin policy which can be useful for pulling in sites / content/Ad from other domain names and they are also relatively safe and that is why most of the web advertising solutions are based on iframes.
If contents to be loaded first and then Ads , it can be done using Iframe.
Iframe helps in improving performance.
Iframe loads independently from other components on the page.
If a user has javascript disabled, iframes will work.
An iframe tag has attributes “height” and “width,” which allows the designer great latitude with dimensions and format like 300×250 , 728×90 depending on the Ad size.
Iframe tag can appear anywhere on the page and several iframes can be added if wished to.
Disadvantage:
It causes accessibility problems.
It is not supported by all the browsers and can display them improperly or even can serve blank.
The main reason for using in web advertisement is security in cross domain support but performance is not perfect.
Iframes can not be seen by many handhelds.
It lowers your SEO score at times.
There are restrictions on the types of campaigns you can host-for example, expandable ads without scrolling content.
If you have multiple ad units on one page, you cannot merge campaigns.
Advertisers avoid using iframes, because using false impressions makes it easier to manipulate the system
What is Script?
The script tag is used to embed a client-side script (JavaScript). The script element either contains scripting statements, or it points to an external script file through the src attribute. Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
Syntax:
<script> Script Contents... </script>
Attributes: Many attribute associated with script tag.
async: It is used to specify the script is executed asynchronously.
charset: It is used to specify the character encoding used in an external script file.
defer: It is used to specify that the script is executed when the page has finished parsing.
src: It is used to specify the URL of an external script file.
type: It is used to specify the media type of the script.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>The script element</h1>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
</body>
</html>
Output:
Advantage:
The majority of browsers supports Jscript.
Javascript tags help in serving any expandable banners.
Multiple ad sizes can be served using same serving code at same place ,(e.g. 468×60 and 728×90)
It puts less load on the server to load.
An iframe can only be rendered into a single place but javascript does not have such rule.
It is supported by almost all handhelds.
No accessibility issue.
Disadvantage:
If the Javascript is disabled by the user , it will serve only the standard banner and not flash content.
They are not loaded independently of the content in a webpage
The Tech Platform
Comments