Getting the content-type of an incoming js file


In a controller I’d like to distinguish between a request initiated by
a client script tag … eg

In other words, is there a way, from within the controller to tell if
it was being called from a client script tag like above…rather than
from within the controller itself?

I don’t mean request.xhr? - the controller being called from the client

I’ve looked at request.content_type, headers[‘content-type’],

Using a litle routing(to the same class) and changing the path above
to /js/pages/my_page I’ve managed but i’d like to keep the path the
same. Am I missing something?

Thank you lots. :Paul