Get dynamically the current url when it is needed