Sometimes, in our AppGini applications we'd like to share data with co-workers or other users by sending a link via email, for example. Unfortunately, this does not work as expected, by default.
I am going to show a very simple, solution, based on our AppGini Helper Javascript Library.
AppGini default behaviour
By default, if we are not logged in already, AppGini redirects us to the login-page first, then to the homepage (index.php
) after login.
This means the user will not see the requested page unless he/she clicks the link again (or copies the url into the browser's address bar).
AppGini Default
But this is not what we want at all. We'd like to redirect the user to the requested page after login, not to the homepage.
Expectation
What we want is, when the recipient clicks the link, his/her browser should open up and show the shared page after login.
Solution
Please note that this is BETA for testing purposes. Please provide feedback if this works for you or not.
We have done all the hard work for you and provide a simple solution:
Code
<!-- file: hooks/header-extras.php --> <script> var common = new AppGiniCommon(); common.autoRedirect(); </script>
That's all you have to do. Just call the autoRedirect()
function on the AppGiniCommon object. Our library will do the rest.
Result
Wanna see it in action?
Pro-Tipp:
This integrates nicely with QR-Codes