In SharePoint 2013 you cannot use JavaScript in the URLAction therefore I have solved the problem by including the JS in the page the link directs to.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="f95c280d-88fb-43ae-bef3-589efd3d3f5a.MenuItemCustomAction1"
RegistrationType="List"
RegistrationId="101"
Location="EditControlBlock"
Sequence="120"
Title="Open in Trapeze">
<UrlAction Url="~appWebUrl/pages/default.aspx?HostUrl={HostUrl}&SPItemURL={ItemUrl}" />
</CustomAction>
</Elements>
I have included the HostUrl and ItemUrl into the Get request so that I can use the information on the next page.
App.js:
var hostweburl = GetUrlKeyValue("HostUrl");
var ItemUrl = GetUrlKeyValue("SPItemURL");
var b = hostweburl.split("://")[1];
var SiteCollection = b.split("/")[0];
var newURL = "abc://" + SiteCollection + ItemUrl
var noSpaceNewURL = newURL.replace(/\s/g, "%20");
$(document).ready(function () {
openNewProtocol();
});
function openNewProtocol() {
window.location = noSpaceNewURL;
$('#message').text('If the document does not load please click the below link');
document.querySelector('#linkdesc').innerHTML = newURL
document.getElementById("newlink").href = noSpaceNewURL;
}
function goBack() {
window.history.back();
}
Default.aspx (has reference to App.js)
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">
<div>
<p id="message"></p>
<p>
Trapeze Link: <a href="#" id="newlink">
<span id="linkdesc"></span>
</a>
</p>
<br />
<p>
<a href="javascript:goBack();">Click here to go back</a>
</p>
</div>
</asp:Content>
The above solution redirects the user to a page where the document opens up in the abc application.
The page gives the user an option to click the link to reopen doc in the application or click to go back.
It would be better to skip out the page altogether, however as the Elements.xml does not allow JavaScript in SharePoint 2013 (it does in 2010) the holding page is required.