I am using InstallShield Express to create a setup project.
I try to add a custom action for Uninstallation, before "System Changes".
The custom action is a JavaScript which will open a window, as below:
window.open("https://www.example.com/", "_blank");
However, when I try to uninstall the program, I get an error said "Microsoft JScript Runtime Error, 'window' is not defined.
Why?
Update:
Finally I choose to use a MSI DLL instead of the script to solve the problem. What should I do with this question? THanks.
The windows object does not exist in NodeJS. However, if you just want to declare a global variable to use it later, you can add the open method in the global object like:
glboal.open = function whatever(url, param2){
// does the stuff you want
};
And then you can use it this way:
conosle.log(global.open('https://www.example.com/','_blank'));
But i still do not recommend creating a global variable for this. Make a function in a file and import it when you need it. Global variables can cause coupling, and make code harder to read. Also, this variable will exist the entire lifetime of the application, and this might not be good if you are going to make more of them.
If you want to read more about why global variables are bad: https://wiki.c2.com/?GlobalVariablesAreBad
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With