> ## Content Index
> Fetch the complete content index at: https://www.oransblog.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# javascript's Little-known  "window" functions
- URL: https://www.oransblog.com/javascript-window/
- Published: 2021-11-05T03:57:26.000Z
- Updated: 2026-10-29T05:57:03.000Z
- Description: My Deep dive into the browsers global "window" object.
- Author: Oran C
- Tags: #Import 2026-11-12 01:14

My Deep dive into the browsers global "window" object.

updated 20211225 -fixed broaken images

# Journey:

I was interested to see what all the functions were on the global window object.

```javascript
Object.getOwnPropertyNames(window).map(x => {
try{
console.log(x, window[x])
}catch(e){
console.log("NOT FOUND")
}
})

```

![](https://www.oransblog.com/content/images/2021/12/image-20.png)

Example output

# Favorite finds

## window.prompt()

![](https://www.oransblog.com/content/images/2021/12/image-23.png)

```javascript
let userResponse = window.prompt("Do you want me to 'sudo rm -rf /' ?")
console.log(userResponse)
```

![](https://www.oransblog.com/content/images/2021/12/image-21.png)

![](https://www.oransblog.com/content/images/2021/12/image-22.png)

sounds legit

## Cool Little known javascript "window" functions

# window.scrollTo(x,y)

```javascript
window.scroll (2,3)
window.scrollBy (2,3)
window.scrollTo(2,3)

```

# window.prompt(text)

```javascript
window.prompt("hi")

```

# window.confirm ("you want tacos?")

```javascript
window.confirm ("you want tacos?")

```

# window.getSelection()

```javascript
window.getSelection()

window.getSelection().toString()
'r/ might be temporarily down or it may have moved permanently to a new web address.\nERR_INVALID_URL'

```

# window.close()

```javascript
close ()
VM1594:1 Scripts may close only the windows that were opened by them.

```

# window.indexedDB

```javascript
window.indexedDB ["cmp"] = "hi"
'hi'
window.indexedDB ["cmp"]
'hi'

```

# window.performance

```javascript
window.performance 
Performance {timeOrigin: 1636056781198.7, onresourcetimingbufferfull: null, timing: PerformanceTiming, navigation: PerformanceNavigation, memory: MemoryInfo, …}
eventCounts: EventCounts {size: 36}
memory: MemoryInfo
jsHeapSizeLimit: 2172649472
totalJSHeapSize: 8010896
usedJSHeapSize: 5962996
[[Prototype]]: MemoryInfo
navigation: PerformanceNavigation
redirectCount: 0
type: 0
[[Prototype]]: PerformanceNavigation
onresourcetimingbufferfull: null
timeOrigin: 1636056781198.7
timing: PerformanceTiming
connectEnd: 1636056781202
connectStart: 1636056781202
domComplete: 1636056781239
....

```

# window.clientInformation

### instreasted info about the current broswer

```javascript
window.clientInformation.geolocation.getCurrentPosition((x)=>{console.log(x)})
VM2092:1 [Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

when on a https website

GeolocationPosition {coords: GeolocationCoordinates, timestamp: 1636057507561}
coords: GeolocationCoordinates {latitude: 38.XXXXXXXXXXXXX, longitude: -122.XXXXXXXXXXXXX, altitude: 0, accuracy: 97, altitudeAccuracy: null, …}
timestamp: 1636057507561
[[Prototype]]: GeolocationPosition
coords: (...)
timestamp: (...)
constructor: ƒ GeolocationPosition()
Symbol(Symbol.toStringTag): "GeolocationPosition"
get coords: ƒ coords()
get timestamp: ƒ timestamp()
[[Prototype]]: Object

```

# window.outerWidth

### Browser outer window width

```javascript
window.outerWidth 
927
window.outerHeight 
1087

// Not sure what this is but something to do with the screen
window.screenX
953
window.screenY 
0

More screen info
window.screen

Screen {availWidth: 1920, availHeight: 1080, width: 1920, height: 1080, colorDepth: 24, …}
availHeight: 1080
availLeft: 0
availTop: 0
availWidth: 1920
colorDepth: 24
height: 1080
orientation: ScreenOrientation {angle: 0, type: 'landscape-primary', onchange: null}
pixelDepth: 24
width: 1920

```

# window.navigator

### window.navigator.onLine

### How to check if the browser is connected to the internet!

```javascript
window.navigator.onLine
true
window.navigator.onLine
false

```

### window.navigator.language

### how to get current language

```javascript
 

```

### window.navigator.connection.effectiveType

### get network speed infromation

```javascript
 
 window.navigator.connection.effectiveType
'4g'

window.navigator.connection
downlink: 2.35
effectiveType: "4g"
onchange: null
rtt: 250
saveData: false

```

### window.navigator.platform

#### get which platform os im on

```javascript
 
 window.navigator.platform
'Win32'

```

# window.history

### get information about past page load like page scroll, or props

```javascript
 
window.history

 length: 7
scrollRestoration: "auto"
state:
metadata: {zva: 1636058463305, Oj: 1636058463306, C6: 1636058463307, Cz: 0}
rAa: {hs: Array(1)}
state:
metadata: {wva: 1636047688812, Pj: 1636047688813, C6: 1636047688814, Cz: 0}
oAa: {hs: Array(1)}
state: null
url: "/search?q=javascript+list+all+functions+of+object&safe=strict&ei=LxuEYayGGNOkqtsPgvW4MA&oq=list+of+all+javascript+functions&gs_lcp=Cgdnd3Mtd2l6EAEYATIFCAAQgAQyBggAEAgQHjIGCAAQCBAeSgQIQRgAUABYAGDeHGgAcAB4AIABjwiIAY8IkgEDNy0xmAEA&sclient=gws-wiz&ved=0ahUKEwjs2b--oP_zAhVTkmoFHYI6DgYQ4dUDCA8&uact=5"
[[Prototype]]: Object
url: "/search?q=javascript+list+all+functions+of+object&safe=

```

# window.location

### window.location.reload()

### run a page reload

```javascript
window.location.reload()

```

# Weird stuff!

### how to create a html comment with javascript!

```javascript
new window.Comment ("sdf")
<!--sdf-->

```

# How to create image,Audio tag with javascript

```
new window.Image (200,200)
<img width=​"200" height=​"200">​

new window.Audio ()
<audio preload=​"auto">​</audio>​

```

# window.URL()

## create url objects

```javascript
new window.URL("http://hihi")
URL {origin: 'http://hihi', protocol: 'http:', username: '', password: '', host: 'hihi', …}
hash: ""
host: "hihi"
hostname: "hihi"
href: "http://hihi/"
origin: "http://hihi"
password: ""
pathname: "/"
port: ""
protocol: "http:"
search: ""
searchParams: URLSearchParams {}
username: ""

Also comes in webkit flavor
new window.webkitURL ("https://www.buts.com")
 

```

# window.Worker

```javascript
new window.Worker ("hellow")
onerror: null
onmessage: null
[[Prototype]]: Worker
onerror: (...)
onmessage: (...)
postMessage: ƒ postMessage()
terminate: ƒ terminate()
constructor: ƒ Worker()
Symbol(Symbol.toStringTag): "Worker"
get onerror: ƒ onerror()
set onerror: ƒ onerror()
get onmessage: ƒ onmessage()
set onmessage: ƒ onmessage()
[[Prototype]]: EventTarget

```

# Escape an unsecape a url string

```
window.unescape ("f%06")
'f\x06'

window.escape ("fuck$")
'fuck%24'

```

# Uncommon console.X commands

### makes a console group with a toggle arrow . cool, neat

```
window.console.group(console.log("hi"))
window.console.groupCollapsed()
window.console.groupEnd()

```

### console.count()

```
window.console.count()
VM6554:1 default: 1
undefined
window.console.count()
VM6559:1 default: 2
undefined
window.console.count()
VM6564:1 default: 3

```

# Inspect things in chrome debugger

### window.inspect

```
window.inspect (x=>x)
x=>x

```

# **Author**

```
by oran collins
github.com/wisehackermonkey
oranbusiness 🕧 gmail <ascii dot> com
20211105
```