I have a website and i have some users that i have to install to them a node-webkit installation to view the websote.
I just have a package.json with main pointed to my url.
This is my code:
{
"name": "nw-demo",
"version": "0.0.1",
"main": "http://dev.its-my-website.com",
"window":{
"toolbar": false,
"frame": true,
"width": 800,
"height": 500,
"position": "mouse",
"min_width": 400,
"min_height": 200
}
}
All its right, but i have a problem, because in my website i have a link that open a new tab and display a pdf file.
The code is :
window.open('xxxxxx')
When i launch with nw start , This link don't open a new window just launch a download of the file.
Thanks Everybody for your Help
Are you blocking popups by any chance with something like...
win.on('new-win-policy',function(frame,url,policy){policy.ignore();}
Without this policy, PDFs open in new windows just fine at my end.
I hope you're not using an old version of NW that didn't support PDFs!
Related
I'm trying to figure out how to use AWS toolkit for vscode. I go to the AWS extension and click Create New SAM Application, point to project directory and it creates a hello world function. Above it, it says Add Debug Configuration. I click that, choose nodejs 12.x and save the launch.json, but I don't get the run option. It still says Add Debug Configuration for some reason. How can I run my lambda functions locally in the console?
The launch.json file generates, but I can never run the code.
launch.json
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "new test:app.lambdaHandler (nodejs12.x)",
"invokeTarget": {
"target": "code",
"projectRoot": "new test/hello-world",
"lambdaHandler": "app.lambdaHandler"
},
"lambda": {
"runtime": "nodejs12.x",
"payload": {},
"environmentVariables": {}
}
}
]
}
I also tried navigating to the hello-world directory in terminal and executing node app.js, but it doesn't return anything
What am I doing wrong? I appreciate the help!
Make sure you have SAM CLI install in local, here are the instructions for installation https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
Then run the command sam local start-api.
You should be able to access the api at http://127.0.0.1:3000/hello
You can also do the same via vscode by selecting Run > Run without debugging (shortcut: ctrl + F5)
I'm trying to develop a Chrome extension within Visual Studio Code and I can't for the life of me figure out how to debug it properly. I can install the extension in Chrome and debug it there with Inspect popup, but I can't find the background.js or any other JavaScript files. I've installed Debugger for Chrome in Visual Studio Code although it doesn't seem to work for Chrome extensions.
Anyone have any ideas?
Instead of having native configuration support like Firefox does, you need to supply arguments to load the extension before running Chrome, specifically the load-extension argument.
Add this line inside your Chrome configuration object with the launch request, located on your .vscode/launch.json file. This assumes that your manifest.json file is directly on the workspace folder. If your manifest.json file is located in another folder, change the ${workspaceFolder} accordingly.
{
"runtimeArgs": ["--load-extension=${workspaceFolder}"]
}
For example, this is how I do it on the launch.json file in my workspace.
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "https://example.com",
"runtimeArgs": ["--load-extension=${workspaceFolder}"]
}
]
}
I was following the tutorial for creating an advanced Outlook add-in here (Git the Gist)
The above is a node.js-app which uses Yeoman and Microsoft Office Add-in Project Generator. To simply start the add-in, you just type 'npm start' in your root project folder.
But: I want to debug the add-in in Visual Studio Code.
VS Code automatically creates a launch.json file when you want to debug a project. This file looks like this:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\bsconfig.json"
}
]
However, when I debug I get the following error:
Cannot launch program 'c:\ZTesting\outlooktest\bsconfig.json'; setting
the outFiles attribute might help.
So are these outFiles truly the problem and - if so - what should they be?
And - if not - what is the solution towards debugging a web add-in created with node.js, Yeoman and Microsoft Office Add-in Project Generator?
The bsconfig.json file looks like this:
{
"ui": {
"port": 3000
},
"server": {
"routes": {
"/node_modules": "node_modules"
}
},
"https": {
"key": "./certs/server.key",
"cert": "./certs/server.crt"
},
"watch": true,
"files": "*.*"
}
I did not find out how to debug the add-in above in Visual Studio Code. However it is possible to debug the add-in with the F12-developer-app from Windows 10.
You can find more information about the F12-app here:
Debug add ins using F12 Developer-app from Windows 10
I have the same problem today.
However, there is a tricky way to debug your outlook add-ins if WIN10 F12-app not able to open your html file.
you can use tbody.append to show any value when you debug your add-ins in outlook
var tbody = $('.prop-table');
tbody.append(makeTableRow("asyncResult: ", item));
function makeTableRow(name, value) {
return $("<tr><td><strong>" + name +
"</strong></td><td class=\"prop-val\"><code>" +
value + "</code></td></tr>");
}
I had this same problem. The root cause is that the app does not actually run on the server. npm start actually runs a separate program, called webpack. You can see this by opening package.json. There should be a line like the following:
"start": "webpack-dev-server --mode development --https --key ./certs/server.key --cert ./certs/server.crt --cacert ./certs/ca.crt --port 3000"
When you run npm start, it adds node_modules/.bin/ to the path before running that line. So this script is actually calling an executable called node_modules/.bin/webpack-dev-server. Webpack does not run any of the code in index.js. It "packs" the code, and broadcasts it over https to the client.
Since the app code only runs on the client, it can only be debugged on the client. The use of npm start makes it look like you're writing server code, but the add-in is actually running clientside.
If i Run the project, it will launch using Google Chrome normal mode.
But how can i launch it using Google Chrome Incognito Mode ?
It is very simple using visual studio 2015 / 2017 / 2019. You just need to add --incognito as command line switch and name the browser something like Google Chrome - Incognito.
That you can do using Browse With.. option in visual Studio.
Step-1:
Step-2:
Note: You can do the same thing with Firefox and Internet Explorer. Here I'm adding Internet Explorer with the -private option.
For
Google Chrome : "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito
Firefox : "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -private-window
Internet Explorer/Microsoft Edge : "C:\Program Files\Internet Explorer\iexplore.exe" -private
For Visual Studio 2017
Select button that usually says IIS Express
Click the down arrow
Select Browse With...
Click Add...
Next to Program write the path to Google Chrome, eg. C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Next to Arguments write --incognito
Next to Friendly name write Google Chrome (Incognito) (or whatever suits your needs)
Click OK
Select your friendly name from before (eg. Google Chrome (Incognito)) and click Set as Default
Now when you click the play button next to IIS Express, Google Chrome starts in Incognito mode.
Not the answer, but in case someone stumbles upon this question, looking for the Visual Studio Code solution, this worked for me:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Chrome: localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/app"
},
{
"type": "chrome",
"request": "launch",
"runtimeArgs": [
"--incognito"
],
"name": "Incog Chrome: localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/app"
}
]
}
However, this does not currently work using the Firefox debugging extension with the -private-window argument. Hope it helps.
I am trying to install an application which is self-publishing. I successfully installed it, but when I open the application itself, no display shows. The icon of the application shows but the content of the app doesn't show anything.
How will I fix it?
This is my manifest.
webapp file:
{"name": "firefoxapp","description":"Example firefox application","launch_path":
"app.html","version": "1","icons": {"512":
"/images/icon_512.png","128":"/images/icon_128.png"},"developer": {"name": "Systema
Computer Solutions Corp.","url": "http://www.systemacorp.com"},"default_locale": "en"}
You have to provide the full path name of the front screen file in launch_path. If your file app.html is in the root folder of your app then try your modified manifest
{
"name": "firefoxapp",
"description":"Example firefox application",
"launch_path": "/app.html","version": "1",
"icons": {
"512":"/images/icon_512.png",
"128":"/images/icon_128.png"},
"developer": {"name": "Systema Computer Solutions Corp.",
"url": "http://www.systemacorp.com"
},
"default_locale": "en"
}