html iframe detect when src changes code example

Example 1: change iframe src

Do not use Inquisitive Iguana's answer! Notice the spelling of facebook in https://facobook.com. Visiting the webpage downloads malware onto your system

Message from my antivirus on my mac: "We've blocked the threat URL:Mal on http://dt.gnpe.com/ptmd from being downloaded."

Example 2: change iframe src by javascript

//change iframe src get the iframe then . and src and provide a value
 document.getElementById("myFrame").src = "https://facobook.com";