New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open URL in same tab and not new window #984

RohitMane opened this Issue May 21, 2018 · 9 comments


5 participants

RohitMane commented May 21, 2018

case "openUrl":


This comment has been minimized.


compulim commented May 21, 2018

Currently, openUrl will open in new window (using


This comment has been minimized.

RohitMane commented May 22, 2018

@compulim you are right "Currently, openUrl will open in new window (using" but I want to open url into current tab/page of browser this is a query. Its like enhancement into WebChat.


This comment has been minimized.

rafaelmaeuer commented May 25, 2018

I am looking for this feature too. If you want your chatbot to help you with page navigation by links this is a necessary feature. Opening in a new tab will destroy the navigation workflow.


This comment has been minimized.

serpino commented May 29, 2018

I'm trying to solve this myself.
How to open in a new tab without losing the flow of conversation.

Is there any way that if the chat opens in several tabs within the same browser, keep the conversationID?


This comment has been minimized.


compulim commented Jun 14, 2018

Thanks everyone.

I have added this as a planning item for customizability, we are planning some big works over there

@serpino you will need to look inside directLine props, you may want to go over this issue. In short, it's more on the DirectLineJS side, than on Web Chat side. But we own both anyway.


This comment has been minimized.

serpino commented Jun 14, 2018

I have been able to solve it by keeping the conversationID in a localstorage when it is a new conversation.
If when opening the chat again in that browser there is a localstorage with that conversationID, I connect with directLine in another way to recover the previous conversation.

Thank you

@compulim compulim changed the title from Open url in same Tab of Browser, Its opening in new tab to Open URL in same tab and not new window Jun 18, 2018


This comment has been minimized.

Snekha-Shivakumar commented Aug 28, 2018

@serpino Can you please provide some code for doing that?


This comment has been minimized.

serpino commented Aug 28, 2018

@Snekha-Shivakumar I detail it step by step
When a botchat object is started, an ID is generated.

This is the one we will use to see if it is a new connection or we must retrieve the messages for that conversation.

The first thing you should do is check if there is any cookie or localstorage with that conversartionID
I use a function like this:

function ReadLocalStorage(key){
		var object = localStorage.getItem(clave);
			//Compruebo cuando se creó la cookie. Si ha pasado mas de un dia la elimino
			if(object !=null){
				var content = jQuery.parseJSON(object);	
				return content.value;

In case of not existing, you create the botchat object and with the following function and the conversationID that is generated, you create the localstorage

function CreateLocalStorage(key, value){		
	var object = {value: valor, timestamp: new Date().getTime()};
		//Se crea el storage con los datos del valor y la fecha de creacion
		localStorage.setItem(clave, JSON.stringify(object));

If it exists, you must create the botchat object with the conversationID that you had saved in the localstorage. This is what you are going to do is retrieve the chat messages for that ID, so when you change the tab you will have them.

With this conversationID you must make a request as explained in the following link, and you will receive the necessary parameters to create the botchat object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment