Got it — so you have a web page with a button that loads a markdown file into a side panel editor.
When the backend URL works, it fetches .md content from the server.
When it fails (404), the editor still shows the markdown — meaning the page must be getting the content from somewhere else, possibly already in memory or embedded in the HTML/JS.
This is a classic “find where the browser got this data” problem.
Here’s how I’d approach it, step-by-step:
- Confirm how the page is built
Before hunting for the data, I’d clarify:
Is this a SPA (React/Vue/Angular) that pulls data via API calls?
Or is it SSR/HTML-based where some of the content might be pre-rendered in the HTML?
You can check this by:
Viewing Page Source (Ctrl+U) — see if any .md content is already embedded as raw text or JSON.
Inspecting Network tab for big initial JSON blobs loaded when the page starts (look at XHR and Fetch categories, not just when you click the button).
- Search in loaded scripts/data
If the editor shows the markdown after a failed request, the data must be somewhere the JS code can access.
I’d try:
In DevTools → Sources tab, search (Ctrl+Shift+F) for a distinctive line of the markdown text.
In DevTools Console, run:
js複製編輯document.body.innerHTML.includes("part of your markdown text")
If true, it’s literally in the DOM somewhere.
If not in DOM, try:
js複製編輯Object.keys(window).filter(k => {
try { return typeof window[k] === 'string' && window[k].includes("part of your markdown text"); }
catch(e) { return false; }
})
or check known global variables.
- Look for preloaded state
Many SPAs preload data in JS variables, often in:
window.INITIAL_STATE
window.NEXT_DATA (Next.js)
window.NUXT (Nuxt)
A hidden tag containing serialized content.
Search (Ctrl+F) in page source for curly braces { followed by big JSON objects.
- Monitor the in-browser memory path
When the request fails but content still shows, that means:
The client JS either already had the data (maybe loaded earlier in a bulk API call).
Or it’s bundled in the JS as a fallback.
Or it caches previous fetches (localStorage, IndexedDB, memory).
You can check:
Application tab in DevTools → Local Storage, Session Storage, IndexedDB, Cache Storage.
Sometimes .md content is stored as plain text or base64.
- Debug the click handler
Find the button element, right-click → Inspect, then:
In Event Listeners pane, find its click handler.
Jump to the JS code.
Set breakpoints on the click function and on the fetch/XMLHttpRequest.send calls.
When 404 happens, step through the code — see if it tries a fallback (maybe reads from local cache or in-memory variable).
- Intercept all function calls
If unsure, monkey-patch fetch:
js複製編輯const oldFetch = window.fetch;
window.fetch = (...args) => {
console.log("FETCH CALLED:", args);
return oldFetch(...args);
};
Then reload and click — you’ll see if any fetch is happening for the fallback.
Also try patching:
js複製編輯const oldOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(...args) {
console.log("XHR:", args);
return oldOpen.apply(this, args);
};
- Search in JS bundles
If nothing comes from network when it fails, the markdown may be literally hardcoded in a JS bundle.
In DevTools → Sources → find the largest .js file → search for a snippet of the markdown text.
Possible conclusions
If it’s in JS variables or preloaded JSON → you can directly grab it from the browser console.
If it’s in IndexedDB/localStorage → export it from Application tab.
If it’s bundled in JS → you can fetch the .js file and parse the embedded content.
If it’s cached from a previous load → DevTools’ “Disable cache” checkbox will make it disappear.
If you want, I can write you a small DevTools console script that tries all these locations in one sweep and tells you where the markdown lives when the request fails.
That way you can pinpoint if it’s DOM, JS var, storage, or cache.
Do you want me to prepare that script?