create a javascript to handle urls