Trying to get the aspx name from the current page from javascript?
Try this
<script language="javascript">
var url = window.location.pathname;
var myPageName = url.substring(url.lastIndexOf('/') + 1);
alert(myPageName);
</script>
As an alternative -
var page = '<%=Path.GetFileName(Request.Path)%>'
Do you want to parse the current window, or rely on asp.net? Both work - it's up to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With