So my problem is Firefox doesn’t recognize .innerText which is used to retrieve the current users name and added to the URL. This works in Safari, Chrome, and IE, but not Firefox. It returns “undefined”
function toggle_visibility( id ) {
var url = 'http://widget.mibbit.com/?settings=46780594e96e435ff18e44e48b7d880d&server=irc.Mibbit.Net&channel=%23yourCh&nick=',
username = document.getElementsByClassName( 'user-nickname' )[0].innerText;
document.getElementById( 'chat' ).setAttribute( 'href', url + username );
So I found this solution for Firefox that needs to be added.
if(document.all){
document.getElementsByClassName( 'user-nickname' )[0].innerText;
}
else{
document.getElementsByClassName( 'user-nickname' )[0].textContent;
}
I need help using the .textContent to retrieve the username in Firefox and still use .innerText also. I’m hoping it’s going in the right direction!
Don’t check for
document.allto useinnerText.Also, the official property is
textContent. You should prioritise that when you check.textwill contain the text nodes joined for the element.