That's not what Format scripts are used for. What you're describing is a Validation script, but validating a URL is extremely complicated.
I would advice against it.
Your second request is possible too, but also tricky.
If each time the user clicks the field it will launch the URL in it, it will be very difficult to edit it...
What I would do is set the field to launch the URL only when the Ctrl (or Cmd on a Mac) key is held down.
You can use this code as the field's MouseUp action to do it:
if (event.target.value && event.modifier) app.launchURL(event.target.value);
Maybe add a tooltip that lets the user know they can Ctrl+Click the field to launch the URL directly.