Strip whitespace before injecting string into js