JavaScript Browser Snippets

The JavaScript snippet collection contains a wide variety of ES6 helper functions. Browser snippets include helper functions for selecting, traversing, and manipulating DOM elements, while general-purpose helpers can be found in the JavaScript snippet collection.

  • insertAfter

    JavaScript, Browser

    Inserts an HTML string after the end of the specified element.

  • insertBefore

    JavaScript, Browser

    Inserts an HTML string before the start of the specified element.

  • isLocalStorageEnabled

    JavaScript, Browser

    Checks if localStorage is enabled.

  • isSessionStorageEnabled

    JavaScript, Browser

    Checks if sessionStorage is enabled.

  • removeElement

    JavaScript, Browser

    Removes an element from the DOM.

  • supportsTouchEvents

    JavaScript, Browser

    Checks if touch events are supported.

  • getProtocol

    JavaScript, Browser

    Gets the protocol being used on the current page.

  • bottomVisible

    JavaScript, Browser

    Checks if the bottom of the page is visible.

  • elementIsFocused

    JavaScript, Browser

    Checks if the given element is focused.

  • isBrowserTabFocused

    JavaScript, Browser

    Checks if the browser tab of the page is focused.