Is it possible to maintain different sessions (users) in different window tabs using Spring 2.5? - spring

We have a requirement where support for different users in different tabs of a browser window. How can we achieve this in Spring 2.5? The application is based on Users, where users will have their own agents and articles. An internal user should be able to login to different user accounts in different tabs at same time and manipulate their data. Any help is much appreciated.

A browser's cookie store does not distinguish between different windows or tabs when deciding what cookies to send. So a cookie based approach won't help.
My suggestion for an alternative would be to have a hidden "userName" parameter that is passed back and forth as a URL query parameter for all requests from a given tab or window. You could finesse the setting of the parameter in browser requests by using some Javascript to add a hidden parameter to each of the HTML forms in the page just loaded. The parameter value would be snarffed from the query string of the current page URL. You'd just need to make sure that all pages included stuff in the header to load the JS and run it when the page load completed.

Generally speaking, no, because all of the tabs within the browser window share the same cookies.
One way to do it would be use multiple domain names all pointing at the same app. Each domain name would have its own set of cookies. You would need to have some way of switching to a new domain name after you open a new tab.
How about, have a set of bookmark toolbar bookmarks, each corresponding to a different domain name. Control-click on the bookmark and it opens in a new tab. You could provide the users links in your navigation to the different domains that they can drag onto their toolbar.
Depending on what browsers your users are using you could get even slicker - in some browsers Javascript window.open() opens a new tab. You could have the JS compute the new domain name before the window.open().

Related

Settings for Custom Tab in Teams

If you go into amend Settings for a custom tab that you have created before, is there anyway to get the existing websiteUrl and contentUrl values in your configuration page?
The microsoftTeams.getContext method doesn't seem to make these Urls available (like it does entityId).
Thanks.
I think you'll need to persist this your side (e.g. in a database), and re-query them from your settings page. This is exactly why the "save" button won't become enabled until you're ready for it (by calling microsoftTeams.settings.setValidityState) - it's for your code to do whatever it needs before allowing the user to actually save any changes.

Render personal tabs dynamically in Ms-Teams using custom application

I have created custom application with static tabs defined in manifest file and it is working fine.
Now, our requirement is that we need to render static (personal) tabs dynamically according to provided Site URL by customer.
For ex. When application installed in teams user will get screen where he will asked for Site URL (API) in textbox and submit it. This will internally check data and give response with tab name, tab URLs and other details then I need to render this tabs dynamically in teams.
enter image description here
Please provide solution for this how I can achieve this ?
It is not possible to add static tabs dynamically. Static or personal tabs are always added through the app manifest and are common to all the users using the app. If you want to configure what tabs to show you can try using a channel tab.
As Gousia said, you can't set the contents of the tab dynamically, and you can't add/remove personal tabs programmatically, but what you could try is having your "tab" be just an iframe host, with width/height basically set to 100%, and then dymically loading the content of the iframe

how to have different Sessions for each tab on IE8

I have a intranet application, Users are validated against a ACtive directory.
I m using session to store data. using InProc Session mode.
when the user open 2 tabs does something onthe tab1 and goes to 2nd tab to do someoperation but im seeing the data in sesssion for teh previous results so this is giving some strange behaviour and the user is not seeing wha ti supposed to seee.
i have around 12 variable in session to keep data but all this messes up when the user opens multiple tabs and confuses the user.
is there a way to do it using c# or javascript to have each tab or window its own session
Help me out with
if possible could you provide me some code samples to achieve this.
you cannot have different sessions in different tabs, because session is domain specific, but you can either change your logic and store variables in FORMs - preferable way, or you can have multiple domains, as it is intranet - you can configure DNS to point all *.intranet.domain to your site, during first call you can redirect user to RANDOM.intranet.domain and put sessions cookie for this domain only, then next problem will be detecting different tabs - use search, there are several approaches, so in new tab you can redirect user to new RANDOM2.intranet.doamin url

Alfresco share page state history

How can I manage page state history in share (surf?) so that I remember for example which yui tab was active and on which page the pager was on?
I noticed that alfresco share does something like that after form submit. You get redirected to the exact same page url where you were before. If any "ajax state" (don't know what they are called) parameters are in url like #something=asdf you get the same url.
But when using manual navigation like moving through site pages those parameters aren't saved.
Is this even a good idea to do? To save page state in session for example?
Some pages have support for URL parameters that are passed in. In those cases the browser history is used, e.g. we editing metadata in the full page meta data view the user is send back to the page he is coming from. This is done in javascript by calling window.history.go(-1) after form submit but only works when parameters are set/retrieved by URL. The document library implements page specific javascript for setting the URL and parsing parameters from it.
I some places Alfresco uses the preference service to store user settings between different pages permanently. For example this is used in the document library for the "show folders" and "simple/thumbnail view" buttons. Here is some sample code from the document library javascript setting a preference option:
var PREFERENCES_DOCLIST = "org.alfresco.share.documentList",
PREF_SHOW_FOLDERS = PREFERENCES_DOCLIST + ".showFolders";
var preferences = new Alfresco.service.Preferences();
this.services.preferences.set(PREF_SHOW_FOLDERS, true);
The evaluation of the properties is usually done in the Share component webscripts, you can have a look in share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\include\documentlist.lib.js for an example.
In any case you have to dig into Alfresco's javascript code in the browser and the share tier to see how to implement it.
You could check parameters sended to the server side after form submiting in the firebug (firefox plugin) and then you could use the same parameters.
Also perhaps you should use yui history manager:

How do I share data across multiple browser tab or windows?

I m currently building a facebook style notification system for my site.
I m using long polling. So, the server sends data if its available and closes the connection.
Now the problem i m facing is that, i want it to share across all open tabs or windows of that browser.
I m using a cookie to detect if a tab is already executing the ajax call, so other tabs will not execute it until the operation of the first tab is complete.
Now what i want is, to have an effective way, so that i can show the data across all open tabs in the form or a small fb style popup box.
The goal is if the last active ajax call has some data, then a small popup box will show up on all open browser tab or windows.
As, a theory i may be able to do it via cookie, but i want to know if there is some better way to do that.
Thanks,
Anjan
Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie.
If you're ok with the cookie idea, follow these examples:
For client side access
For PHP access
For NodeJS

Resources