30秒学会 JavaScript 片段 – currentURL
Returns the current URL. Use window.location.href to get the current URL.
Returns the current URL. Use window.location.href to get the current URL.
Encode a set of form elements as an object. Use the FormData constructor to convert the HTML form to...
Triggers a specific event on a given element, optionally passing custom data. Use new CustomEvent() ...
Makes a POST request to the passed URL. Use XMLHttpRequest web api to make a post request to the giv...
Creates a hash for a value using the SHA-256 algorithm. Returns a promise. Use the SubtleCrypto API ...
Redirects to a specified URL. Use window.location.href or window.location.replace() to redirect to u...
Detects whether the website is being opened in a mobile device or a desktop/laptop. Use a regular ex...
Returns true if the given string is an absolute URL, false otherwise. Use a regular expression to te...
Determines if the current runtime environment is a browser so that front-end modules can run on the ...
Toggles a class for an HTML element. Use element.classList.toggle() to toggle the specified class fo...