1function appendAntiForgeryToken(selector, url) { 2 fetch(`${url}`, { 3 method: 'GET', 4 credentials: 'include', 5 headers: { 6 'Content-Type': 'application/json', 7 }, 8 }) 9 .then(response => response.json()) 10 .then(data => { 11 const token = data.token; 12 13 const inputToken = document.createElement('input'); 14 inputToken.setAttribute('type', 'hidden'); 15 inputToken.setAttribute('name', '__RequestVerificationToken'); 16 inputToken.setAttribute('value', token); 17 18 document.querySelectorAll(selector).forEach(container => { 19 container.appendChild(inputToken); 20 }); 21 }) 22 .catch((error) => { 23 alert('__RequestVerificationToken fails to load.'); 24 console.error('Error fetching anti-forgery token:', error); 25 }); 26}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.