0

I’ve got a bit of javascript that I’m using to add a list item to a list.  It is working in IE, Chrome, Opera, and FireFox.  But Safari is the lone browser causing me grief.  Any ideas on this rather strange error?  I have scoured the web today and found only one vague mention of the problem on this site:
http://www.threewill.com/2013/07/lessons-learned-about-bringing-a-sharepoint-app-to-mobile/
And his suggestion was to use SetTimeout (doesn’t describe how he’s doing it exactly) in order to overcome Safari issues on mobile devices.  My scenario does not address mobile – only desktop browser use.

Any help would be appreciated.  Below is my code:

/*Create a new list item in MyLinks list*/

function AddMyLink(url, desc){

this.clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(‘MyLinks’);

var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);

var urlValue = new SP.FieldUrlValue();
urlValue.set_url(url);
urlValue.set_description(desc);

oListItem.set_item(‘URL’, urlValue);

oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(
function(sender,args){
//console.log(‘Item created: ‘ + oListItem.get_id());
GetMyLinks();
var statusid = SP.UI.Notify.addNotification(‘Your link was successfully added.’);
},
function(sender,args){
var statusid = SP.UI.Notify.addNotification(‘We couldn\’t add your link for some reason. Please refresh the page and try again.’);
console.log(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());
}
);

}

 

(Visited 72 times, 1 visits today)
neilbhisma Answered question November 2, 2018
Add a Comment