- No reason to truncate a String, you use a Textarea field.
- If you wanted just the origin + pathname, that’s literally
document.location.origin + document.location.pathname
All browsers have URL parsers built in and the split() you’re trying is not accurate.