《 back to CoolCodes

Embedding Tutorial

Embed a web page

Use the following code:


  • Replace URL with the full URL (including https://) of the page you would like to embed
  • Replace WW with the desired width for the embedded page
  • Replace HH with the desired height for the embedded page

Example

Using this code...


...will give you this result:

Embed a YouTube video

Use the following code:

videocode

Replace videoID with the ID of the YouTube video.

Getting the video ID

The following YouTube URLs have the video ID highlighted:

  • https​://youtube.com/watch?v=​ZbZSe6N_BXs
  • https​://youtube.com/watch?v=​ZbZSe6N_BXs&si=svdvfukgdgvy7ige4rvu
  • https​://youtu.be/dQw4w9WgXcQ
  • https​://youtu.be/dQw4w9WgXcQ&si=huiwgf3ryuge4vty78bv3

Example

Using this code...

examplecode

...will give you this result:

document.querySelector(".tab-container").innerHTML=document.querySelector(".tab-container").innerHTML.replaceAll("videocode","<iframe src=\"https://www.youtube.com/embed/videoID\" width=560 height=315 frameborder=0 allowfullscreen> ").replaceAll("examplecode","<iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\" width=560 height=315 frameborder=0 allowfullscreen> ");
Pub: 1748225929592 Edit: 1749763382221 Owner: CoolCoder Views: 3