I am currently building a website as part of my Media Coursework for Year 11 but I can't seem to get this If...Else... function to work. Here is my coding.
if(ifr.contentDocument.getElementById("ctl00_ctl00_cphBanner_MenuRedesign_BannerAlertsAndOptionsLoginView_BannerAlertsAndOptions_Authenticated_MessagesTextWrapper") != null){
notify("Personalising site...")
document.getElementById("loginButton").innerHTML = "Account Connected!";
document.getElementById("loginButton").onclick=function(){window.location.href="//roblox.com/--place?id=91276386";}
notify("Account connected successfully");
hideWheel();
}else{
notify("Could not connect account");
hideWheel();
};
I removed the "if(...){...}else{...};" from the code and found it worked, so I'm sure that the fault is in the "if(...)" itself.
If it helps, ifr was actually created using document.createElement("iframe"); The iFrame does have a "src" and does show up on the page with the content displayed.
Any help is appreciated. Thanks.