🥷
Hacksheet
  • README
  • scripts
  • wiki
    • BlockChain
    • Cloud
    • Crypto
    • Database
    • Extensions
    • Index
    • Javascript
    • Linux
    • Network
    • OSINT
    • Others
    • Port
    • Python
    • ReverseEngineering
    • Stego
    • Web
    • Windows
Powered by GitBook
On this page
  • Fetch
  • Open url
  1. wiki

Javascript

PreviousIndexNextLinux

Last updated 2 years ago


Fetch

Get

fetch('http://example.com/', {options})
.then(data => {
	console.log(data);
})
.catch(err => {
	console.log(err);
})

Post

fetch("http://example.com/api/example", {
    method: "POST",
    body: JSON.stringify({
        data: "lolipop",
    }),
    headers: {
        "Content-type": "application/json"
    }
})
.then(response => response.json())
.then(json => console.log(json));

Open url

New tab

window.open('http://example.com');

Change url

document.location = 'http://example.com/''
Fetch
Open url