Both of your sentences make me uncomfortable.
Fused relative clauses with where (or anything else) do act in nominal roles:
SUBJECT: Where we may put this content is the object of our inquiry.
OBJECT: I want to know where we may put this content.
But the use of where clauses as the object of prepositions is limited by the fact that where is a 'pro-locative'—it 'stands for' a locative expression. Most locatives are themselves preposition phrases, the PP's canonical function is as a locative, and a PP as object of a preposition is wonky:
I want to know ∗at where I may put it is more naturally expressed as
I want to know where I may put it.
The problem in your examples lies in the use of restrict. Ordinarily we speak of restricting some object to a location; the complement PP is very close to obligatory, unless it is unambiguously recoverable from context. The absence of this complement is not "wrong", but it leaves the reader feeling that something has been overlooked. Moreover, you make the location the object of restrict rather than its secondary complement, which is odd. And in the final analysis you say the same thing twice: saying where something can appear is equivalent to restricting it to a location.
I think what you really mean is something like
To determine where within the page this context can appear ... or
To restrict this context to a specific location within the page ...
I'm also troubled by your recursive use of context: a 'context' located within another 'context' is in that respect no longer a 'context'. I must suppose that use the word context as a term of art, with a very narrow local meaning.