Удалить весь контент, используя чистый JS

Вы можете попробовать следующее:

// Get current size of heap in bytes
long heapSize = Runtime.getRuntime().totalMemory();

// Get maximum size of heap in bytes. The heap cannot grow beyond this size.
// Any attempt will result in an OutOfMemoryException.
long heapMaxSize = Runtime.getRuntime().maxMemory();

// Get amount of free memory within the heap in bytes. This size will increase
// after garbage collection and decrease as new objects are created.
long heapFreeSize = Runtime.getRuntime().freeMemory();

Как найдено здесь - http://www.exampledepot.com/egs/java.lang/GetHeapSize.html

16
задан Félix Saparelli 22 November 2010 в 00:56
поделиться

2 ответа

Я верю, что это сделает это

document.clear()  //deprecated

window.location = "about:blank"  //this clears out everything
0
ответ дан John Hartsock 22 November 2010 в 00:56
поделиться

УДАЛИТЬ ВСЕ, НО ---! DOCTYPE html ---

var l = document.childNodes.length;    
while (l > 1) { var i = document.childNodes[1]; document.removeChild(i); l--; }

ИСПЫТАНО НА ИНСПЕКТОР FIREFOX - childNodes [1] IS ---! DOCTYPE html ---

-3
ответ дан Brian Tompsett - 汤莱恩 22 November 2010 в 00:56
поделиться
Другие вопросы по тегам:

Похожие вопросы: