Hello! There is a page on which you need to catch a GET request and if id = .. is transmitted, then show the block, and if not hide it. You need to do this with JS .

  • And what are you going to do with id after you captured ?) - haswell
  • @Damon Haswell, you just need to hide or show the editing block. If there is an id then we show the editing block. I agree, stupid, not logical, the main thing is working! And I'll do it faster) - r.mcreal

2 answers 2

You don't need to catch anything. From the side of JS is available the URL of the page in which there will be GET parameters. Just disassemble them from location.search

    Intercepting is a strange idea, but possible through the substitution of certain functions:

     function GEThandler(obj){ console.info("GET Request has been requested"); } let _XMLHttpRequestOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(...args){ if(args[0].toLowerCase() === 'get') GEThandler(this); _XMLHttpRequestOpen.apply(this, args); } let _fetch = fetch; fetch = function(...args){ let config = args[1]; if(config === undefined || (typeof config === 'object' && 'method' in config && (config.method + '').toLowerCase() === 'get')) GEThandler(this); _fetch.apply(this, args); } // XMLHttpRequest let xhr = new XMLHttpRequest(); xhr.open('GET', 'phones.json', true); xhr.send(); // fetch fetch('/');