Script src Property
Get the URL of an external script file:
The result of x will be:
Try it yourself »
Definition and Usage
The src property sets or returns the value of the src attribute of a script.
The src attribute specifies the URL of an external script file.
Note: The external script file cannot contain the <script> tag.
Note: Point to the external script file exactly where you would have written the script.
The src property is supported in all major browsers.
Return the src property:
Set the src property:
|URL||The URL of the external script file.
|Return Value:||A String, representing the URL of the external script file. Returns the entire URL, including the protocol (like http://)|
HTML reference: HTML <script> src attribute
Thank You For Helping Us!
Your message has been sent to W3Schools.