Skip to content

Commit

Permalink
bugfix for IE to open links in new tab (instead of new window)
Browse files Browse the repository at this point in the history
  • Loading branch information
zumoshi committed Jun 13, 2016
1 parent 7d8d8d6 commit 713edf9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
11 changes: 11 additions & 0 deletions BrowserSelect/BrowserSelect.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@
<Content Include="bs.ico" />
<Content Include="License.txt" />
</ItemGroup>
<ItemGroup>
<COMReference Include="SHDocVw">
<Guid>{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>1</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
23 changes: 20 additions & 3 deletions BrowserSelect/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Windows.Forms;
using BrowserSelect.Properties;
using SHDocVw;

namespace BrowserSelect {
public partial class Form1 : Form {
Expand Down Expand Up @@ -70,12 +71,28 @@ private void browser_click(object sender, EventArgs e) {
public static void open_url(Browser b) {
if (b.exec == "edge"){
//edge is a universal app , which means we can't just run it like other browsers
Process.Start("microsoft-edge:"+Program.url
.Replace(" ","%20")
Process.Start("microsoft-edge:" + Program.url
.Replace(" ", "%20")
.Replace("\"", "%22"));
}else if (b.exec.EndsWith("iexplore.exe")){
// IE tends to open in a new window instead of a new tab
// code borrowed from http://stackoverflow.com/a/3713470/1461004
bool found = false;
ShellWindows iExplorerInstances = new ShellWindows();
foreach (InternetExplorer iExplorer in iExplorerInstances)
{
if (iExplorer.Name.EndsWith("Internet Explorer"))
{
iExplorer.Navigate(Program.url, 0x800);
found = true;
break;
}
}
if (!found)
Process.Start(b.exec, "\"" + Program.url.Replace("\"", "%22") + "\"");
}
else
Process.Start(b.exec, "\""+Program.url.Replace("\"","%22")+"\"");
Process.Start(b.exec, "\"" + Program.url.Replace("\"", "%22") + "\"");
Application.Exit();
}

Expand Down
4 changes: 2 additions & 2 deletions BrowserSelect/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ it has been tested on windows 7, windows 8.1 and windows 10. requires **.net fra

# Download

you can download browser select here : [Browser select v1.2.0 (191KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.2.0/BrowserSelect.exe)
you can download browser select here : [Browser select v1.2.1 (191KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.2.1/BrowserSelect.exe)



# Changelog

v1.2.1
- bugfix for InternetExplorer to open links in a new tab instead of a new window

v1.2
- you can now add url patterns to select the browser based on url automatically.

Expand Down

0 comments on commit 713edf9

Please sign in to comment.