Forum: Ruby on Rails Getting the content-type of an incoming js file.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paul V. (Guest)
on 2005-12-12 10:37
(Received via mailing list)
In a controller I'd like to distinguish between a request initiated by
a client script tag ... eg

<script src="/content/pages/my_page" type="text/javascript"></script>

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
w/Ajax.

I've looked at request.content_type, headers['content-type'],
request.env['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
This topic is locked and can not be replied to.