copy paste big dictionary into chrome console
Asked Answered
C

4

30

what im essentially doing is

var dictionary = [ HERE I PASTE ALMOST 200k ENTRIES ]

and it throws :

Error saving setting with name: consoleHistory, value length: 8613059. Error: Failed to set the 'consoleHistory' property on 'Storage': Setting the value of 'consoleHistory' exceeded the quota.

Ten largest settings: Setting: 'consoleHistory', size: 2872834 Setting: 'previouslyViewedFiles', size: 5462 Setting: 'networkLogColumnsVisibility', size: 378 Setting: 'dataGrid-networkLog-columnWeights', size: 340 Setting: 'userAgent', size: 146 Setting: 'Inspector.drawerSplitViewState', size: 94 Setting: 'selectedAuditCategories', size: 79 Setting: 'sourcesPanelNavigatorSplitViewState', size: 65 Setting: 'sourcesPanelSplitViewState', size: 65 Setting: 'InspectorView.splitViewState', size: 42

I want to use the dictionary later to search for things and I hit the wall here.

Coronary answered 26/3, 2015 at 12:4 Comment(6)
to search JSON you aren't required to put it in the console... instead you should be pre-filtering the dataset, maybe with the use of AJAX, if required.Relevant
yeah, i'm not actually searching JSON. I just use the site's scraped/unscrambled js function to iterate through my array. that's why I needed it in the console. does that make sense?Coronary
Honestly? no. You can iterate without printing it to the console. Does Javascript even function with an array with 200k items?Relevant
oh, I don't want to print anything. I just need to use the array. Array worked fine the first time, but I did it it the <top_frame> by accident and it sorta clogged everythingCoronary
In that case then I don't see what this has to do with the google-chrome, storage or console-history tags. The console is used for debugging. The only problem here is that your making an array with 200k items. My original comment remains accurate, pre-filter the dataset before handing it to javascript. an array with a size of 200k is an unrealistic requirement,Relevant
The problem is that the amount of space dedicated to the console's history on devtools is exceeding devtools' quota (4 MB i believe).Brotherhood
M
30

See https://mcmap.net/q/466093/-copy-paste-big-dictionary-into-chrome-console for a more recent answer.


Very outdated answer

The console history is a record of everything that is executed in the console. so every time you're entering the 200k you are appending that to the history. LocalStorage space cant be adjusted its set to 5MB, but as long as your entry is under that and you are just entering it once then this shouldn't be a problem.

You can delete the console history to free up space.
The devtools is just another window so it can be inspected and modified like any other webpage.

Open Dev Tools

  • Select More Tools > Developer Tools from the Chrome Menu.

or

  • Right-click on a page element and selecting "inspect element" in the context menu

or

  • Use Ctrl/Cmd+Shift+I

**Inspect Dev Tools window.**
  1. In another tab/window navigate to chrome://inspect/#other.
  2. Locate the page which starts with "chrome-devtools://devtools/bundled/"
  3. Click the relevant inspect link.

This will open another devtools window where you can inspect and modify the devtools.

Remove consoleHistory form LocalStorage

Navigate to the newly opened devtools window.

Unfortunately typing localStorage.removeItem('consoleHistory'); into the console doesn't work;

So you have to do it the long way.

  1. Open "Resources" panel
  2. Expand "Local Storage" either by double clicking "Local Storage" or click the arrow.
  3. Select the called "devtools://devtools" table. (As its full, it may take a while to open)
  4. locate and select the key called 'consoleHistory'
  5. Hit delete or the "X" button.

Note. This answer has been updated to apply to version 46.0.2490.86. some details my have changed since posting. Please leave a comment if this method no longer applies.

If you are using an older version of chrome and this does not work for you then there is an additional few steps you have to take before using this method. You can find them here .

you can find your version at chrome://chrome/

Morph answered 17/6, 2015 at 16:26 Comment(5)
great answer. Mine was in chrome://inspect/#other (not chrome://inspect/#pages), if that helps someoneCephalopod
your correct, its now chrome://inspect/#other. ill update my answer. thanksMorph
Panel is now called "Application" instead of "Resources". Otherwise, this works perfectly. Thanks!Interregnum
chrome://inspect/#other, press inspect then Application, Local Storage, chrome-devtools://devtools"Kunstlied
For others finding this Answer: please see Devin Fields' for a more up-to-date and simpler approach.Samhita
S
77

2018 update:

Confirmed on Version 65.0.3325.181, you can simply right-click anywhere inside the devtools console and click "Clear console history." It solved the problem for me. I ran into this issue earlier and, having never seen it before, began going through the first couple steps to TarranJones' solution.

Socialism answered 3/4, 2018 at 22:44 Comment(2)
Thanks, nothing else helped me hack them online word games.Coronary
i was writing a js code in console, and was getting this error. so actually i didn't want to clear my console history, i just wanted to get rid of the error message. so it's good to add a warning!Suomi
M
30

See https://mcmap.net/q/466093/-copy-paste-big-dictionary-into-chrome-console for a more recent answer.


Very outdated answer

The console history is a record of everything that is executed in the console. so every time you're entering the 200k you are appending that to the history. LocalStorage space cant be adjusted its set to 5MB, but as long as your entry is under that and you are just entering it once then this shouldn't be a problem.

You can delete the console history to free up space.
The devtools is just another window so it can be inspected and modified like any other webpage.

Open Dev Tools

  • Select More Tools > Developer Tools from the Chrome Menu.

or

  • Right-click on a page element and selecting "inspect element" in the context menu

or

  • Use Ctrl/Cmd+Shift+I

**Inspect Dev Tools window.**
  1. In another tab/window navigate to chrome://inspect/#other.
  2. Locate the page which starts with "chrome-devtools://devtools/bundled/"
  3. Click the relevant inspect link.

This will open another devtools window where you can inspect and modify the devtools.

Remove consoleHistory form LocalStorage

Navigate to the newly opened devtools window.

Unfortunately typing localStorage.removeItem('consoleHistory'); into the console doesn't work;

So you have to do it the long way.

  1. Open "Resources" panel
  2. Expand "Local Storage" either by double clicking "Local Storage" or click the arrow.
  3. Select the called "devtools://devtools" table. (As its full, it may take a while to open)
  4. locate and select the key called 'consoleHistory'
  5. Hit delete or the "X" button.

Note. This answer has been updated to apply to version 46.0.2490.86. some details my have changed since posting. Please leave a comment if this method no longer applies.

If you are using an older version of chrome and this does not work for you then there is an additional few steps you have to take before using this method. You can find them here .

you can find your version at chrome://chrome/

Morph answered 17/6, 2015 at 16:26 Comment(5)
great answer. Mine was in chrome://inspect/#other (not chrome://inspect/#pages), if that helps someoneCephalopod
your correct, its now chrome://inspect/#other. ill update my answer. thanksMorph
Panel is now called "Application" instead of "Resources". Otherwise, this works perfectly. Thanks!Interregnum
chrome://inspect/#other, press inspect then Application, Local Storage, chrome-devtools://devtools"Kunstlied
For others finding this Answer: please see Devin Fields' for a more up-to-date and simpler approach.Samhita
F
7

I too ran into this issue (needing to clear consoleHistory) when I maxed out its capacity. In this case clicking on chrome-devtools://de... in inspector would crash the window and trying to delete via localStorage.clear() or localStorage.removeItem() would timeout or be otherwise unsuccessful.

My solution was deleting the localStorage data files themselves.

On a mac, the instructions are:

cd ~/Library/Application\ Support/Google/Chrome/Default/Local\ Storage
rm chrome-devtools_devtools_0.localstorage
rm chrome-devtools_devtools_0.localstorage-journal

A quick google search suggests on Windows it's %LocalAppData%\Google\Chrome\User Data\Default\Local Storage, but you may need to double check.

Framework answered 21/9, 2015 at 17:28 Comment(0)
N
0

You can be a little more surgical than the other answers here suggest. Instead of wiping out all console history (which allows for recovering previous commands with the ↑ Arrow), you can just remove the large entries that are exceeding the quota.

  1. Open up your regular dev tools

  2. Open the dev tools inspector (Ctrl + Shift + I with dev tools in focus)

  3. Grab the consoleHistory from localStorage, remove the large entries, and replace with the new value

    var currentHistory = JSON.parse(localStorage.getItem("consoleHistory"))
    var filteredHistory = currentHistory.filter(el => el.length < 2000)
    localStorage.setItem("consoleHistory", JSON.stringify(filteredHistory, null, 0))
    
Nosedive answered 25/3, 2023 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.