If your experience is like mine, you memorized Joshua 1:8 a long time ago:
This book of the law shall not depart out of thy mouth; but thou shalt meditate therein day and night, that thou mayest
observe to do according to all that is written therein: for then thou shalt make thy way prosperous, and then thou shalt have
good success (KJV).
I am reading through Dillard and Longman’s An Introduction to the Old Testament (Zondervan, 1994) in preparation for doctoral entrance exams, and in demonstrating the many connections between Deuteronomy and Joshua, they draw the connection between Joshua 1:8 (“this book of the law”) and Deuteronomy’s self-designation as “this book of the law” (Deut 31:26) (Dillard and Longman 115) — the Hebrew is precisely the same.
I had never given much specific thought to the context of God’s words to Joshua at the beginning of the book of Joshua, but had sort of a picture of Joshua standing out in the open, perhaps looking over the Jordan toward the Promised Land, when God broke through his reverie and spoke to him in the words recorded in Joshua 1:2-9. In giving it thought, however, I suppose Joshua must have been in the tabernacle before the ark of the covenant. This is, after all, where God specially manifested his presence to Israel, and where Moses had spoken with the Lord (cf. Num 7:89). Looking forward to the aftermath of Ai’s defeat (Josh 7:6), we find Joshua and the elders of Israel prostrated before the ark as representative of the presence of the Lord. As a clincher, in Deut 31, just after the commissioning of Joshua (with language found reiterated in Joshua 1:2-9!), Moses gives the Levites instructions about where to keep the book of the Law that he has just finished writing:
And the LORD commissioned Joshua the son of Nun and said, “Be strong and courageous, for you shall bring the people of Israel into the land that I swore to give them. I will be with you.” When Moses had finished writing the words of this law in a book to the very end, Moses commanded the Levites who carried the ark of the covenant of the LORD, “Take this Book of the Law and put it by the side of the ark of the covenant of the LORD your God, that it may be there for a witness against you.” (Deut 31:23-26)
It would only make sense that when the Lord says to Joshua “This book of the Law shall not depart from your mouth” (Josh 1:8), Joshua would be in the presence of the “book of the Law” referenced by “this”. And the place for that book of the Law was by the side of ark of the covenant.