IFrame:
Code:
To do this you just need to add a line of code
<iframe src="http://www.google.com" width="400px" height="200px">
IFrame Busting:
But there are cases you don't want your website to be contained in some other website. And you can stop it to be placed inside some other website. To do that you need to use a technique called Iframe Busting or Anti-Framing.
For example:
If you add the HTML code below to you webpage it will redirec you to windows live home page.
<iframe src="http://www.hotmail.com" width="400px" height="200px">
The reason is that hotmail does like it to be contained inside some other webpage.
To achieve this in your webpage you don't need to do a lot. Just copy and paste the line below to you javascript code in the <head> and that's it.
if (top != self) { top.location.replace(self.location.href); }
That's the whole miracle.
In the post about IFrame we will come up with a technique called "IFrame Busting Buster". In-case you want to force a page to be used in your webpage inside an iframe.
An <iframe> tag of HTML allows you to add a website as an object to a particular region in you website. You can open a link inside you page at any place. So you webpage will be a container of that target webpage.
For Example: I can open http://www.google.com/ inside my blog in a particulart region as below:
Code:
To do this you just need to add a line of code
<iframe src="http://www.google.com" width="400px" height="200px">
IFrame Busting:
But there are cases you don't want your website to be contained in some other website. And you can stop it to be placed inside some other website. To do that you need to use a technique called Iframe Busting or Anti-Framing.
For example:
If you add the HTML code below to you webpage it will redirec you to windows live home page.
<iframe src="http://www.hotmail.com" width="400px" height="200px">
The reason is that hotmail does like it to be contained inside some other webpage.
To achieve this in your webpage you don't need to do a lot. Just copy and paste the line below to you javascript code in the <head> and that's it.
if (top != self) { top.location.replace(self.location.href); }
That's the whole miracle.
In the post about IFrame we will come up with a technique called "IFrame Busting Buster". In-case you want to force a page to be used in your webpage inside an iframe.
No comments:
Post a Comment