/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 var url = "http://example.com/a/b/fish.html"; url.substring( 0, url.lastIndexOf("/") ); // returns http://example.com/a/b
Comments
                    Subscribe to comments
                
                