JavaScript String link() Method Last Updated : 04 Jun, 2024 Comments Improve Suggest changes Like Article Like Report The link() method of String values creates a string that embeds this string in an <a> element ( <a href="...">str</a> ), to be used as a hypertext link to another URL, All HTML wrapper methods are deprecated and only standardized for compatibility purposes. Note: This method is deprecated in JavaScript. Syntaxstring.link("url")Parameters:url: Here you have to pass a string representing the URL. Return Value:A string embedded within an <a> tag has a specified URL as the href attribute. Example 1: In the example below we will see the basic usage of the link() method. JavaScript let str = "GeeksForGeeks"; console.log(str.link("https://www.geeksforgeeks.org/")); Output<a href="https://www.geeksforgeeks.org/">GeeksForGeeks</a> Example 2: In the example below, we will use the link() method with a concatenated string. JavaScript let str1 = "Visit "; let str2 = "GeeksForGeeks"; console.log((str1 + str2).link("https://www.geeksforgeeks.org/")); Output<a href="https://www.geeksforgeeks.org/">Visit GeeksForGeeks</a> Example 3: In the example below we will use nested HTML tags with the link() method. JavaScript let str = "Click here for <em>GeeksForGeeks</em>"; console.log(str.link("https://www.geeksforgeeks.org/")); Output<a href="https://www.geeksforgeeks.org/">Click here for <em>GeeksForGeeks</em></a> Comment More infoAdvertise with us Next Article JavaScript String link() Method pankajbind Follow Improve Article Tags : JavaScript Web Technologies javaScript Similar Reads JavaScript string anchor() Method The JavaScript anchor() method creates an anchor element that is used as a hypertext target that means when you use the anchor method in JavaScript the anchor method returns <a> elements with string and also returns "anchorname" as the value of "name" attribute like this:<a name=anchorname 2 min read HTML <link> Tag The HTML <link> tag defines the relationship between the current document and an external resource, often for stylesheets or favicons. It's an empty element with attributes like href and rel.Note: The <link> tag also supports the Global Attributes and  Event Attributes in HTML.Syntax 2 min read PHP | symlink( ) function The symlink() function in PHP is an inbuilt function which is used to create a symbolic link for a target which already exists. It helps to create a specific name link for a target. The target and link names are sent as parameters to the symlink() function and it returns True on success and False on 2 min read PHP | link( ) Function The link() creates a hard link for a specified target. The target and the link are passed as parameters to the link() function and it returns true on success and false on failure.Syntax: link(target, link)  Parameters Used: The link() function in PHP accepts two parameters. target : It is a manda 2 min read Hyperlink Vs Hypertext Hyperlink and hypertext are fundamental concepts in web technology. Hypertext refers to text containing links to other text or media, enhancing navigation and information retrieval. Hyperlinks are the actual links embedded in hypertext, directing users to different sections, pages, or resources.Tabl 2 min read How To Link Pages In HTML? In HTML, linking pages is the fundamental practice that allows users to navigate from one web page to the another within same website or to an entirely different website. These links, also known as hyperlinks, are created using the <a> tag, which can direct the users to another HTML document, 5 min read PHP linkinfo() Function The linkinfo() function is an inbuilt function in PHP that retrieves information related to the links. This function checks the link is pointed to by the path that exists. Syntax: linkinfo(string $path)Parameter: This function accepts one parameter that is described below: $path:  This parameter spe 1 min read URL getRef() method in Java with Examples The getRef() function is a part of URL class. The function getRef() returns the Reference or anchor part of a specified URL. Function Signature: public String getRef() Syntax: url.getRef() Parameter: This function does not require any parameter Return Type: The function returns String Type Below pro 2 min read How to Convert a String to URL in Java? In Java, a string is a sequence of characters. A URL, which is short for Uniform Resource Locator, refers to a web resource that specifies its location on a computer network and provides the mechanism for retrieving it. To represent a URL in Java, we use the java.net.URL class. In this article, we w 2 min read How to Create Symbolic Links and Hard Links in Java? Java file system provides both hard and symbolic links, which let us make references to files and directories. In this article, we will learn how to create symbolic links and hard links in Java. Soft Links or Symbolic Links: Symbolic links are names of files or directories. They may stretch across s 3 min read Like