An iFrame (inline frame) is an HTML tag that allows you to embed another website or document on your website. You can embed webpages, videos and maps in an iframe. An iFrame itself does not pose any security concern to your website, but you should always use iframe code from trusted sources or websites. Hackers can use hidden iframes to include malicious code on your website. 

Embedding content from another website is useful especially when you want to legally and ethically share content that is not yours, since embedded content is not considered as copyright infringement. Also, the method comes into play when sharing large files, such as video, audio, or even images, since they will not be hosted on your website.

How to convert a webpage to HTML embed code

The best and easiest way to embed a webpage to your website is manually adding an iFrame code to an HTML widget on your site.

  1. Copy the HTML <iframe> tag below.
<iframe loading="lazy" src="https://victormochere.com" style="border:0px #ffffff none;" name="Victor Mochere" scrolling="no" frameborder="1" marginheight="0px" marginwidth="0px" height="150px" width="300px" allowfullscreen></iframe>
  1. On your website, add an HTML widget to the location you want the embedded webpage to appear.
  2. Paste the HTML <iframe> tag you just copied into the HTML widget.
  3. Edit the code attributes to suit your specifications including the URL. The list of attributes highlighted below will guide you.
  4. Click “OK” or “Save”.
  5. You have now embedded content onto your website or blog.

Attributes

AttributeValueDescription
srcURLSpecifies the URL of the webpage/document/map/video to embed.
nametextSpecifies the name of an <iframe>.
scrollingauto
yes
no
Indicates when the browser should provide a scrollbar for the frame: “auto” – only when the frame’s content is larger than its dimensions, “yes” – always show a scrollbar, “no” – never show a scrollbar.
frameborderintegerDraws a border around this frame. Default frameborder is 1. The value 0 removes the border around this frame.
marginheightintegerThe amount of space in pixels between the frame’s content and its top and bottom borders.
marginwidthintegerThe amount of space in pixels between the frame’s content and its left and right borders.
heightpixelsSpecifies the height of an <iframe>. Default height is 150 pixels.
widthpixelsSpecifies the width of an <iframe>. Default width is 300 pixels.
allowfullscreentrue
false
Set to true if the can activate fullscreen mode by calling the requestFullscreen() method.
allow Specifies a feature policy for the <iframe>.
srcdocHTML_codeSpecifies the HTML content of the page to show in the <iframe>.
alignleft
center
right
The alignment of the <iframe> with respect to the surrounding context.
referrerpolicyno-referrer
no-referrer-when-downgrade
origin
origin-when-cross-origin
same-origin
strict-origin
strict-origin-when-cross-origin
unsafe-url
Specifies how much/which referrer information that will be sent when processing the iframe attributes.
sandboxallow-forms
allow-pointer-lock
allow-popups
allow-same-origin
allow-scripts
allow-top-navigation
Enables an extra set of restrictions for the content in an <iframe>.

Leave a Reply

Your email address will not be published. Required fields are marked *