Is it a bad practice to add href via javascript like below? In IE8, I’m seeing the status bar loading continuously even though the page has been updated and I suspect the below code is causing that to occur.
document.getElementById('sucessMsgId').innerHTML = 'Your profile has been updated. <a href='+xProfileUri+'>View Profile</a>';
What is the right way to do it? Does using jQuery to fix the above code could solve the IE status bar loading issue?
UPDATE: Found that the IE browser status loading continuously because it gets into this part of jQUery code and does not finish executing. This happens when I attach a load event to an iframe and only in IE8.
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
This was due to multiple events happening at the same time and the UI being updated with the success message at the same time. Delayed the update of UI by adding a setTimeout to the function call that updates the UI.