Edge Introspection Toolkit & Command-Line Flag Suite

Edge Introspection Toolkit & Command-Line Flag Suite

A self-contained reference for page introspection bookmarklets, Edge runtime inspection, and a high-signal command-line flag suite suitable for deep reverse-engineering, deterministic analysis, and automation.


1. Page introspection bookmarklet (static snapshot)

1.1. Ready-to-use bookmarklet (single line)

Use this as the URL for a bookmark.

javascript:(function(){try{var d=document,w=window;function gAll(s){return Array.prototype.slice.call(d.querySelectorAll(s));}function mapNodes(nodes,fn){return nodes.map(function(n){try{return fn(n);}catch(e){return {error:e+''};}});}var perfRes=[];try{if(w.performance&&w.performance.getEntriesByType){perfRes=w.performance.getEntriesByType('resource').map(function(e){return{name:e.name,initiatorType:e.initiatorType,entryType:e.entryType,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,startTime:e.startTime,duration:e.duration};});}}catch(e){}var data={page:{url:w.location.href,title:d.title,referrer:d.referrer},scripts:mapNodes(gAll('script'),function(s){return{src:s.src||null,inline:!s.src&&s.textContent? (s.textContent.trim().slice(0,2000)) : null,type:s.type||null,async:!!s.async,defer:!!s.defer,crossorigin:s.getAttribute('crossorigin'),nonce:s.getAttribute('nonce'),id:s.id||null};}),links:mapNodes(gAll('link'),function(l){return{rel:l.rel||null,href:l.href||null,as:l.getAttribute('as'),crossorigin:l.getAttribute('crossorigin'),type:l.type||null,media:l.media||null,referrerpolicy:l.referrerPolicy||null,fetchpriority:l.getAttribute('fetchpriority')};}),anchors:mapNodes(gAll('a[href]'),function(a){return{href:a.href,text:(a.textContent||'').trim().slice(0,200),rel:a.rel||null,role:a.getAttribute('role'),ariaLabel:a.getAttribute('aria-label'),ariaLabelledby:a.getAttribute('aria-labelledby'),id:a.id||null};}),elementsWithId:mapNodes(gAll('[id]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id,classes:el.className||null,role:el.getAttribute('role'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby')};}),ariaElements:mapNodes(gAll('[role],[aria-label],[aria-labelledby],[aria-hidden],[aria-modal]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id||null,classes:el.className||null,role:el.getAttribute('role'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby'),ariaHidden:el.getAttribute('aria-hidden'),ariaModal:el.getAttribute('aria-modal')};}),modals:mapNodes(gAll('[role="dialog"],[role="alertdialog"],[aria-modal="true"],.modal,[data-modal],[data-dialog]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id||null,classes:el.className||null,role:el.getAttribute('role'),ariaModal:el.getAttribute('aria-modal'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby')};}),navRelations:mapNodes(gAll('link[rel]'),function(l){return{rel:l.rel,href:l.href||null,as:l.getAttribute('as'),type:l.type||null,media:l.media||null};}),resources:perfRes};var win=w.open('about:blank','_blank');if(!win){alert('Popup blocked: please allow popups for this site.');return;}var pre=win.document.createElement('pre');pre.textContent=JSON.stringify(data,null,2);win.document.body.appendChild(pre);win.document.title='Page inspection snapshot';}catch(e){alert('Error in bookmarklet: '+e);}})();

1.2. Readable version (for editing / extension)

javascript:(function () {
  try {
    var d = document;
    var w = window;

    function gAll(sel) {
      return Array.prototype.slice.call(d.querySelectorAll(sel));
    }

    function mapNodes(nodes, fn) {
      return nodes.map(function (n) {
        try { return fn(n); }
        catch (e) { return { error: String(e) }; }
      });
    }

    // Resource timing: subresources & initiator types
    var perfResources = [];
    try {
      if (w.performance && w.performance.getEntriesByType) {
        perfResources = w.performance.getEntriesByType('resource').map(function (e) {
          return {
            name: e.name,
            initiatorType: e.initiatorType,
            entryType: e.entryType,
            transferSize: e.transferSize,
            encodedBodySize: e.encodedBodySize,
            decodedBodySize: e.decodedBodySize,
            startTime: e.startTime,
            duration: e.duration
          };
        });
      }
    } catch (e) {}

    var data = {
      page: {
        url: w.location.href,
        title: d.title,
        referrer: d.referrer
      },

      // <script> tags
      scripts: mapNodes(gAll('script'), function (s) {
        return {
          src: s.src || null,
          inline: !s.src && s.textContent
            ? s.textContent.trim().slice(0, 2000)
            : null,
          type: s.type || null,
          async: !!s.async,
          defer: !!s.defer,
          crossorigin: s.getAttribute('crossorigin'),
          nonce: s.getAttribute('nonce'),
          id: s.id || null
        };
      }),

      // <link> tags, including preconnect/preload/prefetch etc.
      links: mapNodes(gAll('link'), function (l) {
        return {
          rel: l.rel || null,
          href: l.href || null,
          as: l.getAttribute('as'),
          crossorigin: l.getAttribute('crossorigin'),
          type: l.type || null,
          media: l.media || null,
          referrerpolicy: l.referrerPolicy || null,
          fetchpriority: l.getAttribute('fetchpriority')
        };
      }),

      // All anchors with href
      anchors: mapNodes(gAll('a[href]'), function (a) {
        return {
          href: a.href,
          text: (a.textContent || '').trim().slice(0, 200),
          rel: a.rel || null,
          role: a.getAttribute('role'),
          ariaLabel: a.getAttribute('aria-label'),
          ariaLabelledby: a.getAttribute('aria-labelledby'),
          id: a.id || null
        };
      }),

      // Every element with an ID
      elementsWithId: mapNodes(gAll('[id]'), function (el) {
        return {
          tag: el.tagName.toLowerCase(),
          id: el.id,
          classes: el.className || null,
          role: el.getAttribute('role'),
          ariaLabel: el.getAttribute('aria-label'),
          ariaLabelledby: el.getAttribute('aria-labelledby')
        };
      }),

      // ARIA elements snapshot
      ariaElements: mapNodes(
        gAll('[role],[aria-label],[aria-labelledby],[aria-hidden],[aria-modal]'),
        function (el) {
          return {
            tag: el.tagName.toLowerCase(),
            id: el.id || null,
            classes: el.className || null,
            role: el.getAttribute('role'),
            ariaLabel: el.getAttribute('aria-label'),
            ariaLabelledby: el.getAttribute('aria-labelledby'),
            ariaHidden: el.getAttribute('aria-hidden'),
            ariaModal: el.getAttribute('aria-modal')
          };
        }
      ),

      // Rough modal detection
      modals: mapNodes(
        gAll('[role="dialog"],[role="alertdialog"],[aria-modal="true"],.modal,[data-modal],[data-dialog]'),
        function (el) {
          return {
            tag: el.tagName.toLowerCase(),
            id: el.id || null,
            classes: el.className || null,
            role: el.getAttribute('role'),
            ariaModal: el.getAttribute('aria-modal'),
            ariaLabel: el.getAttribute('aria-label'),
            ariaLabelledby: el.getAttribute('aria-labelledby')
          };
        }
      ),

      // Navigation relations via link[rel]
      navRelations: mapNodes(gAll('link[rel]'), function (l) {
        return {
          rel: l.rel,
          href: l.href || null,
          as: l.getAttribute('as'),
          type: l.type || null,
          media: l.media || null
        };
      }),

      // Resource timing data – subresources & initiators
      resources: perfResources
    };

    // Dump into a new window as JSON
    var win = w.open('about:blank', '_blank');
    if (!win) {
      alert('Popup blocked: please allow popups for this site.');
      return;
    }
    var pre = win.document.createElement('pre');
    pre.textContent = JSON.stringify(data, null, 2);
    win.document.body.appendChild(pre);
    win.document.title = 'Page inspection snapshot';
  } catch (e) {
    alert('Error in bookmarklet: ' + e);
  }
})();

2. Advanced page introspector (streaming observers)

Pattern

Single global state object, idempotent setup, bounded rolling buffers, and a singleton output window with a periodic dump(). Designed “for the interpreter”: compact, re-entrant, and runtime-centric.

2.1. Ready-to-use bookmarklet (single line)

javascript:(function(){try{var D=document,W=window;function A(s,c){return Array.prototype.slice.call((c||D).querySelectorAll(s));}function M(xs,f){return xs.map(function(n){try{return f(n);}catch(e){return{error:String(e)}}});}function T(s,l){if(!s)return null;s=s.trim();return s.length>l?s.slice(0,l):s}var S=W.__PAGE_INTROSPECTOR__||(W.__PAGE_INTROSPECTOR__={meta:{started:Date.now()},page:{},static:{},dynamic:{mutations:[],resources:[],longtasks:[]}});S.meta.lastRun=Date.now();S.page={url:W.location.href,title:D.title,referrer:D.referrer};S.static.scripts=M(A('script'),function(s){return{src:s.src||null,inline:s.src?null:T(s.textContent||'',2000),type:s.type||null,async:!!s.async,defer:!!s.defer,crossorigin:s.getAttribute('crossorigin'),nonce:s.getAttribute('nonce'),id:s.id||null}});S.static.links=M(A('link'),function(l){return{rel:l.rel||null,href:l.href||null,as:l.getAttribute('as'),crossorigin:l.getAttribute('crossorigin'),type:l.type||null,media:l.media||null,referrerpolicy:l.referrerPolicy||null,fetchpriority:l.getAttribute('fetchpriority')}});S.static.anchors=M(A('a[href]'),function(a){return{href:a.href,text:T(a.textContent||'',200),rel:a.rel||null,role:a.getAttribute('role'),ariaLabel:a.getAttribute('aria-label'),ariaLabelledby:a.getAttribute('aria-labelledby'),id:a.id||null}});S.static.elementsWithId=M(A('[id]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id,classes:el.className||null,role:el.getAttribute('role'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby')}});S.static.ariaElements=M(A('[role],[aria-label],[aria-labelledby],[aria-hidden],[aria-modal]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id||null,classes:el.className||null,role:el.getAttribute('role'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby'),ariaHidden:el.getAttribute('aria-hidden'),ariaModal:el.getAttribute('aria-modal')}});S.static.modals=M(A('[role="dialog"],[role="alertdialog"],[aria-modal="true"],.modal,[data-modal],[data-dialog]'),function(el){return{tag:el.tagName.toLowerCase(),id:el.id||null,classes:el.className||null,role:el.getAttribute('role'),ariaModal:el.getAttribute('aria-modal'),ariaLabel:el.getAttribute('aria-label'),ariaLabelledby:el.getAttribute('aria-labelledby')}});S.static.navRelations=M(A('link[rel]'),function(l){return{rel:l.rel,href:l.href||null,as:l.getAttribute('as'),type:l.type||null,media:l.media||null}});function cap(arr,max){if(arr.length>max)arr.splice(0,arr.length-max);}if(!S.__observersSetup){S.__observersSetup=true;try{if(W.PerformanceObserver){var ro=new PerformanceObserver(function(list){list.getEntries().forEach(function(e){S.dynamic.resources.push({name:e.name,initiatorType:e.initiatorType,entryType:e.entryType,startTime:e.startTime,duration:e.duration,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize});cap(S.dynamic.resources,400);});});try{ro.observe({type:'resource',buffered:true});}catch(_){ro.observe({entryTypes:['resource']});}var no=new PerformanceObserver(function(list){list.getEntries().forEach(function(e){S.dynamic.resources.push({name:e.name,initiatorType:e.initiatorType||'navigation',entryType:e.entryType,startTime:e.startTime,duration:e.duration,type:e.type});cap(S.dynamic.resources,450);});});try{no.observe({type:'navigation',buffered:true});}catch(_){no.observe({entryTypes:['navigation']});}var lo=new PerformanceObserver(function(list){list.getEntries().forEach(function(e){S.dynamic.longtasks.push({name:e.name||'longtask',entryType:e.entryType,startTime:e.startTime,duration:e.duration});cap(S.dynamic.longtasks,200);});});try{lo.observe({type:'longtask',buffered:true});}catch(_){lo.observe({entryTypes:['longtask']});}}}catch(e){}try{var mo=new MutationObserver(function(muts){muts.forEach(function(m){var rec={t:Date.now(),type:m.type,targetTag:m.target&&m.target.tagName?m.target.tagName.toLowerCase():null,targetId:m.target&&m.target.id||null,added:[],removed:[],attrName:m.attributeName||null};if(m.type==='attributes'){rec.attrValue=m.target && m.attributeName?m.target.getAttribute(m.attributeName):null;}if(m.type==='childList'){Array.prototype.forEach.call(m.addedNodes||[],function(n){if(n.nodeType===1){rec.added.push({tag:n.tagName.toLowerCase(),id:n.id||null,classes:n.className||null,role:n.getAttribute('role'),ariaLabel:n.getAttribute('aria-label')});}});Array.prototype.forEach.call(m.removedNodes||[],function(n){if(n.nodeType===1){rec.removed.push({tag:n.tagName.toLowerCase(),id:n.id||null,classes:n.className||null,role:n.getAttribute('role'),ariaLabel:n.getAttribute('aria-label')});}});}S.dynamic.mutations.push(rec);cap(S.dynamic.mutations,300);});});mo.observe(D.documentElement||D.body||D,{subtree:true,childList:true,attributes:true,attributeFilter:['role','id','class','aria-label','aria-labelledby','aria-hidden','aria-modal']});S.dynamic.__mo=mo;}catch(e){}}var win=S.__win;if(!win||win.closed){win=W.open('about:blank','_blank');if(!win){alert('Popup blocked: enable popups and retry bookmarklet.');return;}S.__win=win;var pre=win.document.createElement('pre');pre.style.whiteSpace='pre-wrap';pre.style.font='11px/1.4 monospace';win.document.body.style.margin='0';win.document.body.appendChild(pre);win.document.title='Page inspection stream';S.__pre=pre;}var pre=S.__pre||S.__win.document.querySelector('pre');function dump(){if(!S.__win||S.__win.closed)return;pre.textContent=JSON.stringify({meta:S.meta,page:S.page,static:S.static,dynamic:S.dynamic},null,2);}dump();if(!S.__interval){S.__interval=W.setInterval(dump,2000);} }catch(e){alert('Introspector error: '+e);}})();

2.2. Runtime structure & patterns

  • Global state container: window.__PAGE_INTROSPECTOR__ with meta, page, static, dynamic.
  • Static view: recomputed on each invocation: scripts, links, anchors, elements with IDs, ARIA cluster, modal heuristics, navigation relations.
  • Dynamic view: rolling buffers: mutations, resources, longtasks.
  • Observers:
    • PerformanceObserver for resource, navigation, longtask.
    • MutationObserver on documentElement (fallback body), watching childList and selected attributes (role, id, class, aria-*).
  • Rolling caps: bounded arrays via cap(arr, max) to avoid unbounded growth.
  • Output channel: singleton about:blank window with a <pre> element, refreshed every 2 seconds by dump().
  • Idempotent setup: observers and interval created once; subsequent runs only recompute static snapshot and refresh the view.

3. Edge version and runtime paths

3.1. Raw values

Field Value
Executable path C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
Profile path C:\Users\Liber8\AppData\Local\Microsoft\Edge\User Data\Default
Variations Seed Type Null 143.0.3650.96 (Official build) (64-bit)

3.2. Interpretation

  • Executable path: canonical entry point for: CDP (--remote-debugging-port), headless mode, automation harnesses, and runtime shells.
  • Profile path: state substrate containing preferences, cookies, extensions, storage, history, and other runtime data for the Default profile.
  • Variations seed type “Null”: indicates no variations/experiments are loaded; the browser runs with default feature configuration for that build, which is ideal for deterministic analysis.

4. Microsoft Edge command-line flag suite

4.1. Profile and state isolation

Flag Purpose
--user-data-dir="C:\path\to\profile" Use a custom profile directory; isolates state for reproducible runs.
--profile-directory="Default" Select a specific profile within the user-data directory.
--no-first-run Skip first-run experience and onboarding surfaces.
--disable-features=msEdgeFirstRun Disable Edge-specific first-run flows where applicable.

4.2. Privacy / InPrivate / ephemeral behavior

Flag Purpose
--inprivate Launch Edge directly in InPrivate mode.
--incognito Chromium synonym for incognito mode; also recognized by Edge.
--disable-sync Disable account/profile sync (sign-in dependent features).

4.3. Debugging and DevTools Protocol

Flag Purpose
--remote-debugging-port=9222 Expose Chrome DevTools Protocol (CDP) on the specified port.
--remote-allow-origins=* Allow CDP connections from any origin (useful for local tooling).
--enable-logging --v=1 Enable logging with verbosity level 1.
--log-net-log="C:\temp\netlog.json" Capture detailed network logs into the specified file.

4.4. Rendering, GPU, and compositing controls

Flag Purpose
--disable-gpu-sandbox Disable GPU sandbox (may be used in controlled test environments).
--disable-gpu Force software rendering; useful for isolating GPU-related issues.
--use-angle=gl Force ANGLE backend to OpenGL for more deterministic behavior.
--force-device-scale-factor=1 Disable DPI scaling variance; ensures stable viewport metrics.

4.5. Network and resource loading

Flag Purpose
--ignore-certificate-errors Ignore TLS certificate errors (for local/dev only).
--disable-http-cache Disable HTTP caching; forces fresh loads for each request.
--enable-features=NetworkService Force network service mode (where supported).
--host-resolver-rules="MAP * 127.0.0.1" Override all host resolution to localhost (extreme isolation).

4.6. Navigation, startup, and windowing

Flag Purpose
--app="https://example.com" Launch a specific URL as an “app” window (minimal UI).
--start-maximized Start the browser maximized.
--kiosk "https://example.com" Kiosk mode for a dedicated app-like experience.

4.7. Security, policy, and experiment control

Flag Purpose
--disable-features=RendererCodeIntegrity Disable renderer code integrity checks in controlled environments.
--disable-features=IsolateOrigins,site-per-process Relax strict site isolation (not recommended outside test harnesses).
--disable-features=EdgeExperimentation Disable Edge’s experiment framework where applicable.
--disable-field-trial-config Disable variations and field trials for more deterministic behavior.
--disable-features=OptimizationGuideModelDownloading Disable downloading of certain ML optimization models.

4.8. Headless and automation-oriented flags

Flag Purpose
--headless=new Run in the modern headless mode.
--disable-software-rasterizer Disable software rasterizer; for deterministic headless behavior.
--mute-audio Disable audio output (useful in CI and automation).

4.9. Example: full engineering harness command

The following example combines the above flags into a single, high-utility command suitable for deterministic and debuggable runs:

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" ^
  --user-data-dir="C:\temp\edge-profile" ^
  --profile-directory="Default" ^
  --no-first-run ^
  --inprivate ^
  --remote-debugging-port=9222 ^
  --remote-allow-origins=* ^
  --enable-logging --v=1 ^
  --log-net-log="C:\temp\netlog.json" ^
  --disable-http-cache ^
  --disable-features=EdgeExperimentation,OptimizationGuideModelDownloading ^
  --disable-features=RendererCodeIntegrity ^
  --force-device-scale-factor=1 ^
  --start-maximized

This setup yields an isolated profile, no onboarding, CDP access, full network logging, no caching, reduced experiment noise, and stable layout metrics.


5. Using and sharing this reference

5.1. As a standalone HTML reference

  • Save: Store this file as edge-introspection-toolkit.html.
  • Open: Double-click to open it in any modern browser (including Edge).
  • Share: Send the file directly or host it on any static file server / gist.

5.2. Installing the bookmarklets

  • Step 1: Create a new bookmark in Edge.
  • Step 2: Set the bookmark’s URL to one of the javascript:(function(){...})() snippets from sections 1 or 2.
  • Step 3: Click the bookmark on any page you want to introspect.

5.3. Running the command-line harness

  • Step 1: Open cmd or PowerShell.
  • Step 2: Paste the command from section 4.9 (adapt paths as needed).
  • Step 3: Use CDP tooling, DevTools, or your own harness to attach and inspect.

Comments

Popular posts from this blog