Front End Technology Articles - Page 630 of 745

How to add an address element in HTML?

Yaswanth Varma
Updated on 02-Sep-2022 11:21:48

1K+ Views

The address tag in HTML identifies a person's or an organization's contact details. The address tag has several meanings when used in different places in an HTML page, such as, when it is used within the tag, it will display the document's contact information; and if it appears inside the tag, it stands in for the article's contact details. This tag will only take global attributes. These attributes belong to every element in the HTML document even though some elements won’t be affected with these. Syntax Address... Note − The address tag must always ... Read More

Create a shortcut key to activate an element in HTML

Yaswanth Varma
Updated on 02-Sep-2022 11:16:45

3K+ Views

We can design a keyboard shortcut to carry out certain actions, such clicking a link or button, for Displaying the Keyboard text. When defining the element, we may utilise the accesskey attribute to specify a keyboard shortcut for that control element. This attribute must contain at least one printable character, including the accented/other characters that can be inputted using a keyboard. However, different browsers use different ways to activate the accesskey on its platform − Windows Linux INTERNET EXPLORER Alt + key Alt + Shift + key N/A MOZILLA ... Read More

In JavaScript inheritance how to differentiate Object.create vs new?

Abhinanda Shri
Updated on 24-Jan-2020 10:16:54

212 Views

In the first example, you are just inheriting amitBaseClass prototype.function SomeClass() { } SomeClass.prototype = Object.create(amitBaseClass.prototype);In the second example, you are executing the constructor function. An instance of amitBaseClass is created and you are inheriting the who complete amitBaseClass object.function SomeClass () { } SomeClass.prototype = new amitBaseClass ();So, both are doing separate work.

How to perform Automated Unit Testing with JavaScript?

Chandu yadav
Updated on 24-Jun-2020 06:43:52

264 Views

To perform unit testing in JavaScript, use Unit.js. It is a cross-platform open-source unit testing framework.ExampleLet’s say the following in your test code −var example = ‘Welcome’; test.string(example) .isEqualTo(‘Welcome’);The function demo() displays a suit of tests, whereas demo1() is an individual test specification,demo('Welcome’, function() {    demo1('Welcome to the website', function() {       var example = ‘Welcome’;       test.string(example)       .isEqualTo(‘Welcome’);    }); });

How to use sockets in JavaScriptHTML?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:22

270 Views

To use sockets, consider the WebSocket interface in JavaScript. This interface enables web applications to maintain bidirectional communications with server-side processes. To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the WebSocket interface. Here are some of the methods to workaround with Web Sockets − socket = new WebSocket(url [, protocols ] ) Create a new socket using this, wherein parameters URL is a string for the connection and protocols is a string or array of string. socket . send( data ) The above is used to send data. Used to ... Read More

How to disable browser's back button with JavaScript?

George John
Updated on 24-Jan-2020 10:16:08

3K+ Views

To disable web browsers’ back button, try to run the following code. This is the code for current HTML page,Example           Disable Browser Back Button                               Next Page               $(document).ready(function() {          function disablePrev() { window.history.forward() }          window.onload = disablePrev();          window.onpageshow = function(evt) { if (evt.persisted) disableBack() }       });     The following is the code for newpage.html,           Go to back page using web browser back button.     a

Is it safe to assume strict comparison in a JavaScript switch statement?

Priya Pallavi
Updated on 24-Jun-2020 06:44:25

188 Views

To get out of the confusion regarding strict comparison, try to run the following code snippet in JavaScript −Exampleswitch(1) {    case '1':       alert('Switch comparison: Not Strict.');       break;    case 1:       alert('Switch comparison: Strict.');       break;    default:       alert(‘Default’); }

What is JavaScript AES Encryption?

Lokesh Badavath
Updated on 21-Nov-2022 14:54:35

15K+ Views

In this article, we are going to learn what is JavaScript AES Encryption. AES is an algorithm developed for the encryption of data. AES uses the same key to encrypt and decrypt data, called the symmetric encryption algorithm. AES encryption is Advanced Encryption Standard (AES) to encrypt the data in the application. We use the JavaScript library Forge to perform AES encryption. These algorithms are used in different communication apps such as WhatsApp, Signal, etc. The third-party user cannot be able to decrypt the message, and when the message is reached the destination receiver endpoint, it is decrypted using the ... Read More

How to get the body's content of an iframe in JavaScript?

Lokesh Badavath
Updated on 21-Nov-2022 10:57:03

24K+ Views

We use getIframeContent(frameId), to get the object reference of an iframe in JavaScript. To get the element in an iframe, first we need access the element inside the JavaScript using the document.getElementById() method by passing iframe id as an argument. Using iframetag The tag in HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. The element is supported in every browser like (Google Chrome, Microsoft edge/ internet explorer, Firefox, safari, and opera). We are using srcdoc attribute in tag to specify the HTML content of ... Read More

Is their a negative lookbehind equivalent in JavaScript?

Ankith Reddy
Updated on 24-Jun-2020 06:45:12

115 Views

For a negative look-behind in JavaScript, use the following −(^|[^\])"To replace double quotes, you can use the following −str.replace(/(^|[^\])"/g, "$1'")

Advertisements