0

From JavaScript loaded via a static HTML5 file [loaded from a Joomla page element's onClick event and window.open()], does an AJAX request to a PHP script inherit the session context such that JFactory::getUser() returns the currently logged-in user?

1 Answer 1

1

Short answer is yes.

From the browser side, any request, ajax or otherwise, will, by default, include the cookies for that domain. The window, the javascript, the onclick event, the staticness of the html, are irrelevant.

From the server side, the session cookie will be processed by the session handler if the joomla application is loaded.

There are exceptions to both of the above but usually you have to do some work to stop the session from working normally.

1
  • I can confirm this. I use this function in some custom joomla modules.
    – Huw Evans
    Oct 25 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.