Javascript Best Window Location Pattern