Answers for "javascript check if url ends with slash"

0

check url if it has trailing slash

$getWholeUrl = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['REQUEST_URI']."";

//The output would be 
/*
  http://localhost/tabulation/event/event_name/
*/

if(substr($getWholeUrl , -1)=='/'){
    //Add your condition here

}
Posted by: Guest on August-26-2020
0

javascript check if url ends with slash

url = url.replace(/\/?$/, '/');
Posted by: Guest on October-14-2021

Code answers related to "javascript check if url ends with slash"

Code answers related to "Javascript"

Browse Popular Code Answers by Language