When opening a SharePoint 2010 form in modal mode I get the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'href')
See code below for usage and troubleshooting.
$(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(OnLoad, "sp.js"); function OnLoad() { var id = GetUrlKeyValue("ID", false, location.href); <== Error createCookie("Parent", id); // Create cookie } // End onload }); // End document ready
I'm not sure what happened yesterday, but this has been working for years in other projects in SP, but for this particular project just popped up this error.
window.location.href
. Let me know if it works.