Added condition check on the existence of the target parameter before
passing the url.