Load external script depending on window size

Hello I need some quick help for a school project,

I need a script for the head of my HTMl file that examines the size of the browser window. If the browser is a certain size, then the HTML will load a external javascript. Is this possible?

Thank you

First you need to get the size of the window
Most browsers (all new browsers) use innerHeight and innerWidth
IE uses the clientHeight and width of the body (IEg and ‘quirks’ mode
or the document.documentElement (the html element)


function viewsize(){
	var b= document.body, d= document.documentElement;
	if(typeof window.innerHeight==='number'){
		return [window.innerWidth, window.innerHeight];
	}
	return [Math.max(b.clientWidth, d.clientWidth),
	Math.max(b.clientHeight, d.clientHeight)]
}