Restrict postMessage handler to valid data and remove trailing slash from location URL