Question

I'm looking for a way to close all the user's active browser for only during the installation. After the installation finishes, I'd like the browsers to return to their previous state with all the tabs they had.

I looked here: Close All Browser In Nsis

And I tried adding something like ExecShell "open" "chrome.exe" but it doesn't seem to open the browsers with the previous tabs.

Any ideas? thanks!!

Was it helpful?

Solution

You can use nsProcess plugin

For Chrome

Function CloseRestoreChrome
${nsProcess::FindProcess} "chrome.exe" $IsRestoreChrome
StrCmp $IsRestoreChrome 0 0 +3
logex::Write "$dt Chrome running."
${nsProcess::KillProcess} "chrome.exe" $R0

;Dow your work here

${If} $IsRestoreChrome == 0
StrCpy $path "$LocalAppData\Google\Chrome\Application\chrome.exe --restore-last-session"
exec $path
logex::Write "$dt Chrome restored"
${EndIf}
FunctionEnd

Similarly you can Find and Kill process of Firefox and IE.

OTHER TIPS

Closing browser(s) is simple by using Kill Proc plug-in.

But be careful with it - every time give the user a chance to saved his work at least with Message Box (Yes/No/Cancel).

When browser is closing it should save all tabs and whole session automatically. If not then it must be configured in settings (which is of course different for every browser) to do it.

Changing settings automatically can be done via configuration file (for Chrome it is called Preferences) but this is a pretty rude.

So if browser is configured to save/load all tabs automatically this will work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top