adding a script tag, depending on the type of request