For eg: In localhost:4502/editor.html/content/sample if i use window.location.href or any other js methods
it is returning only location:4502/content/sample.
for touch UI, you can use below:
it is coming in console but if i use it in js file it is showing as undefined.
Where are you writing code. Inside sites js or dialog js?
If you need editor page when editing then create js with cq.authoring.dialog category.