A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/src below:

HTMLScriptElement: src property - Web APIs

HTMLScriptElement: src property

Baseline Widely available *

The src property of the HTMLScriptElement interface is a string representing the URL of an external script; this can be used as an alternative to embedding a script directly within a document.

It reflects the src attribute of the <script> element.

Value

A string.

Examples

Assume the code is running on a website whose URL is https://example.com.

<script id="script-with-src" type="module" src="/main.js"></script>
<script id="script-without-src" type="module"></script>
const script_with_src = document.getElementById("script-with-src");
console.log(script_with_src.src); // Output: "https://example.com/main.js"
const script_without_src = document.getElementById("script-without-src");
console.log(script_without_src.src); // Output: ""
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3