swte

Untitled

Jul 11th, 2025
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const cookieDescriptor = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie') || Object.getOwnPropertyDescriptor(HTMLDocument.prototype, 'cookie');
  2.  
  3. Object.defineProperty(document, 'cookie', {
  4.     get: function() {
  5.           return cookieDescriptor.get.call(document);
  6.     },
  7.     set: function(cookieString) {
  8.           const cookieName = cookieString.split('=')[0].trim();
  9.  
  10.           if (nem követő kuki){
  11.                 cookieDescriptor.set.call(document, cookieString);
  12.           }
  13.     },
  14.     configurable: false,
  15.     enumerable: true
  16. });
Advertisement
Add Comment
Please, Sign In to add comment