Viewing Chrome Cache
In Chrome
chrome://cache/
Click on whichever file you want to view
Settings > Tools > JavaScript Console
Paste code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
(function() { var preTags = document.getElementsByTagName('pre'); var preWithHeaderInfo = preTags[0]; var preWithContent = preTags[2]; var lines = preWithContent.textContent.split('\n'); var text = ''; for (var i = 0; i < lines.length; i++) { var line = lines[i]; var firstIndex = 11; // first index of the chars to match var indexJump = 4; var totalCharsPerLine = 16; index = firstIndex; for (var j = 0; j < totalCharsPerLine; j++) { var hexValAsStr = line.substr(index, 2); if (hexValAsStr == ' ') { // no more chars break; } var asciiVal = parseInt(hexValAsStr, 16); text += String.fromCharCode(asciiVal); index += indexJump; } } var headerText = preWithHeaderInfo.textContent; var elToInsertBefore = document.body.childNodes[0]; var insertedDiv = document.createElement("div"); document.body.insertBefore(insertedDiv, elToInsertBefore); // find the filename var nodes = [document.body]; var filepath = ''; while (true) { var node = nodes.pop(); if (node.hasChildNodes()) { var children = node.childNodes; for (var i = children.length - 1; i >= 0; i--) { nodes.push(children[i]); } } if (node.nodeType === Node.TEXT_NODE && /\S/.test(node.nodeValue)) { // 1st depth-first text node (with non-whitespace chars) found filepath = node.nodeValue; break; } } outputResults(insertedDiv, convertToBase64(text), filepath, headerText); insertedDiv.appendChild(document.createElement('hr')); function outputResults(parentElement, fileContents, fileUrl, headerText) { // last updated 1/27/12 var rgx = /.+\/([^\/]+)/; var filename = rgx.exec(fileUrl)[1]; // get the content type rgx = /content-type: (.+)/i; var match = rgx.exec(headerText); var contentTypeFound = match != null; var contentType = "text/plain"; if (contentTypeFound) { contentType = match[1]; } var dataUri = "data:" + contentType + ";base64," + fileContents; // check for gzipped file var gZipRgx = /content-encoding: gzip/i; if (gZipRgx.test(headerText)) { filename += '.gz'; } // check for image var imageRgx = /image/i; var isImage = imageRgx.test(contentType); // create link var aTag = document.createElement('a'); aTag.textContent = "Left-click to download the cached file"; aTag.setAttribute('href', dataUri); aTag.setAttribute('download', filename); parentElement.appendChild(aTag); parentElement.appendChild(document.createElement('br')); // create image if (isImage) { var imgTag = document.createElement('img'); imgTag.setAttribute("src", dataUri); parentElement.appendChild(imgTag); parentElement.appendChild(document.createElement('br')); } // create warning if (!contentTypeFound) { var pTag = document.createElement('p'); pTag.textContent = "WARNING: the type of file was not found in the headers... defaulting to text file."; parentElement.appendChild(pTag); } } function getBase64Char(base64Value) { if (base64Value < 0) { throw "Invalid number: " + base64Value; } else if (base64Value <= 25) { // A-Z return String.fromCharCode(base64Value + "A".charCodeAt(0)); } else if (base64Value <= 51) { // a-z base64Value -= 26; // a return String.fromCharCode(base64Value + "a".charCodeAt(0)); } else if (base64Value <= 61) { // 0-9 base64Value -= 52; // 0 return String.fromCharCode(base64Value + "0".charCodeAt(0)); } else if (base64Value <= 62) { return '+'; } else if (base64Value <= 63) { return '/'; } else { throw "Invalid number: " + base64Value; } } function convertToBase64(input) { // http://en.wikipedia.org/wiki/Base64#Example var remainingBits; var result = ""; var additionalCharsNeeded = 0; var charIndex = -1; var charAsciiValue; var advanceToNextChar = function() { charIndex++; charAsciiValue = input.charCodeAt(charIndex); return charIndex < input.length; }; while (true) { var base64Char; // handle 1st char if (!advanceToNextChar()) break; base64Char = charAsciiValue >>> 2; remainingBits = charAsciiValue & 3; // 0000 0011 result += getBase64Char(base64Char); // 1st char additionalCharsNeeded = 3; // handle 2nd char if (!advanceToNextChar()) break; base64Char = (remainingBits << 4) | (charAsciiValue >>> 4); remainingBits = charAsciiValue & 15; // 0000 1111 result += getBase64Char(base64Char); // 2nd char additionalCharsNeeded = 2; // handle 3rd char if (!advanceToNextChar()) break; base64Char = (remainingBits << 2) | (charAsciiValue >>> 6); result += getBase64Char(base64Char); // 3rd char remainingBits = charAsciiValue & 63; // 0011 1111 result += getBase64Char(remainingBits); // 4th char additionalCharsNeeded = 0; } // there may be an additional 2-3 chars that need to be added if (additionalCharsNeeded == 2) { remainingBits = remainingBits << 2; // 4 extra bits result += getBase64Char(remainingBits) + "="; } else if (additionalCharsNeeded == 3) { remainingBits = remainingBits << 4; // 2 extra bits result += getBase64Char(remainingBits) + "=="; } else if (additionalCharsNeeded != 0) { throw "Unhandled number of additional chars needed: " + additionalCharsNeeded; } return result; } })() |