Вопрос

Is it possible to pass dynamic data to the browser when it automatically GETs link and img and script etc tags after it has parsed the html containing them? Ultimately would want to pass an authentication token to allow the server to decide whether or not to return the resource.

Context: I am trying to help somebody with a search UI for a text file database. There is a folder on a (physical) server which the (software) server can serve static files from. There is another folder which the (software) server is configured not to serve static files from. So if somebody puts in the URL for an image (for example) in the private folder, nothing is returned. I want to be able to send a token (stored in session if the user has logged in) along with all initial GET requests as the browser loads the page. So if you are logged in, the server will see the token and return files from the private folder. I have a Python/WSGI setup at the server so can check for the token to determine whether or not to return data from the private folder. Since the browser GETs the initial resources automatically I don't see how I can add my token.

Это было полезно?

Решение

This is what I was looking for: https://developer.mozilla.org/en/docs/Setting_HTTP_request_headers In particular the section on creating an observer to listen for the notification "http-on-modify-request". Appreciate the advice regardless.

Лицензировано под: CC-BY-SA с атрибуция
scroll top