Taken out if statement to tell if content already loaded as seems to be the issue. Think I need to check for the item in storage, either that or try catch in javascript.