I am trying to redirect to another site (say www.google.com) from a SharePoint site. I tried using window.location.href and window.location.replace but it doesn't work.
It adds the URL to current page URL and displays a page not found error.
The URL is not replacing th epage, instead it just appends at the end of the current page URL.

Code:
function getItemDetails() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Reports');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededItem), Function.createDelegate(this, this.onQueryFailedItem));
}
function onQuerySucceededItem(sender, args) {
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
if(oListItem.get_id() == getParameter('ID')){
web = oListItem.get_item('Web_x0020_Link');
}
}
window.location.href = web;
}
function onQueryFailedItem(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
Can someone help me with this?
window.location.href = 'https://google.com'orwindow.location.href = '//google.com'. Both worked for me