Ad

Node Module "open" Is Not Opening URL

- 1 answer

I am trying to open URL using node module OPEN, but it is not working. I have installed Open and i can see the open module in node module folder.

Below is my code.

const open = require('open');

 open('https://myurl');

I am working on Microsoft bot framework. Deployed the code in AZURE. The same code is working in emulator but in browser it is not working.

Any help is appreciated.

Thanks Sanjeev Gautam

Ad

Answer

When building bots - or any web app really - it is important to consider that there are two sides: the server and the client. When you are connected to the Emulator you are running the bot locally, so the server is running locally. When you deployed the bot the server is running in Azure and no longer has access to the user's machine.

Looking at your code, you are calling open('https://myurl') on the bot side or the server side - not the client side. When the bot is running locally, the server opens the web page on your machine so everything seems to work fine, but when it's running on Azure, it's trying to open the web page in Azure which isn't accessible to the user.

Unfortunately, you cannot control the behavior of the client from the server, so you will have to send a card with an open url action or send the link to the user to follow.

Ad
source: stackoverflow.com
Ad