My goal is to achieve the following:
var siteBaseUrl = window.location.origin;
However, in IE 9 it returns undefined
I am attempting to grasp how I can utilize modernizr based on the advice provided here:
$window.location.origin gives wrong value when using IE
To address this issue, I made a modification to my code by adding the following block before my siteurl:
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
}
var siteBaseUrl = window.location.origin;
This adjustment now functions properly, although I am uncertain if implementing modernizr as suggested in the provided link could offer an alternative solution. Alternatively, it's plausible that I may be overcomplicating things and the aforementioned code works effectively with the assistance of modernizr.