"myIpAddress" function returns incorrect result in Internet Explorer 9

Note: The Internet Explorer 11 desktop application will be retired and go out of support on June 15, 2022 (for a list of what's in scope, see the FAQ). The same IE11 apps and sites you use today can open in Microsoft Edge with Internet Explorer mode. Learn more here.

Symptoms

Consider the following scenarios.

Scenario 1

  • You configure Windows Internet Explorer 9 to use a proxy auto-config (PAC) file.

  • The computer is connected to the Internet.

  • You install an application on the computer that adds a virtual adapter. For example, you install VMware Player.

  • The PAC file calls the myIpAddress function to retrieve the IP address of the network adapter that is used to access the Internet.

In this scenario, the myIpAddress function returns the IP address of the virtual adapter.

For example, you write the following function in the PAC file. In this situation, the myIpAddress function returns the IP address of the virtual adapter.function FindProxyForURL(url, host)
{
if (shExpMatch(myIpAddress(), "10.0.0.*")
{
//Bypass the proxy for URLs with-in the local domain
if (shExpMatch(host, "*.local.domain.com")) { return "DIRECT"; }

//Bypass the proxy when accessing local sites
if (isPlainHostName(host)) { return "DIRECT"; }

// Everything else goes through Proxy
return "PROXY 10.0.0.254:8080";
}

//Assume the computer is not at work.
return "DIRECT";
}
Scenario 2

  • You configure Internet Explorer 9 to use a PAC file.

  • The computer is connected to the Internet.

  • You establish an additional connection to your corporate network through a virtual private network (VPN).

  • The PAC file calls the myIpAddress function to retrieve the IP address from the VPN connection.

In this scenario, the myIpAddress function returns the IP address of the Internet connection.

Workaround

To work around this issue, write your own custom myIpAddress function for Internet Explorer 9. For example, you can write the following function:function myIE9IpAddress()
{
var ipex = myIpAddressEx();
if (ipex === false)
{
var myip=myIpAddress();
return myip;
}
var iparray = ipex.split(";");
for (j=0; j < iparray.length;j++)
{
var ipaddress=iparray[j];
//IPv6 adress : skip
var parts=ipaddress.split("::");
var firstpart=parts[0];
if (firstpart==="[fe80")
{
//alert("skipping IPv6 address :"+ ipaddress);
continue;
}

//IPv4 address starting with 192.: skip
parts=ipaddress.split(".");
firstpart=parts[0];
if (firstpart === "192")
{
//alert("skipping IPv4 address starting with 192. :"+ ipaddress);
continue;
}
break;
}
return ipaddress;
}

Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix Download Available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote The "Hotfix Download Available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must have Internet Explorer 9 installed.

Registry information

Important
Follow the steps in this section carefully. Serious problems might occur if you modify the registry incorrectly. Before you modify it, back up the registry for restoration in case problems occur.

After you apply this hotfix, you must make the following changes to the registry:

  1. Click Start, click Run, type regedit, and then click OK.

  2. Expand the following subkey:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl

  3. Right-click FeatureControl, click New, and then click Key.

  4. Type FEATURE_SMART_MYIPADDRESS_BEHAVIOR_KB2839111, and then press Enter to name the new subkey.

  5. Right-click FEATURE_SMART_MYIPADDRESS_BEHAVIOR_KB2839111, click New, and then click DWORD Value.

  6. Type iexplore.exe, and then press Enter to name the new entry.

  7. Right-click iexplore.exe, and then click Modify.

  8. In the Value data box, type 00000001, and then click OK.

  9. Close Registry Editor.

For x64-based computers, you must also modify another registry key:

  1. Click Start, click Run, type regedit, and then click OK.

  2. Expand the following subkey:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl

  3. Right-click FeatureControl, click New, and then click Key.

  4. Type FEATURE_SMART_MYIPADDRESS_BEHAVIOR_KB2839111, and then press Enter to name the new subkey.

  5. Right-click FEATURE_SMART_MYIPADDRESS_BEHAVIOR_KB2839111, click New, and then click DWORD Value.

  6. Type iexplore.exe, and then press Enter to name the new entry.

  7. Right-click iexplore.exe, and then click Modify.

  8. In the Value data box, type 00000001, and then click OK.

  9. Close Registry Editor.

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.

File information notes Important Windows 7 hotfixes and Windows Server 2008 R2 hotfixes are included in the same packages.

For Internet Explorer 9 on all supported x86-based versions of Windows 7

File name

File version

File size

Date

Time

Platform

Jsproxy.dll

9.0.8112.20618

75,776

18-Aug-2013

10:00

x86

Wininet.dll

9.0.8112.20618

1,130,496

18-Aug-2013

10:02

x86

Wininetplugin.dll

1.0.0.1

66,048

18-Aug-2013

10:00

x86

Iertutil.dll

9.0.8112.20618

1,796,096

18-Aug-2013

09:59

x86

Sqmapi.dll

6.0.6000.16386

149,664

18-Aug-2013

10:18

x86

For Internet Explorer 9 on all supported x64-based versions of Windows 7 and of Windows Server 2008 R2

File name

File version

File size

Date

Time

Platform

Jsproxy.dll

9.0.8112.20618

97,280

18-Aug-2013

11:02

x64

Wininet.dll

9.0.8112.20618

1,392,640

18-Aug-2013

11:03

x64

Wininetplugin.dll

1.0.0.1

86,528

18-Aug-2013

11:02

x64

Iertutil.dll

9.0.8112.20618

2,147,840

18-Aug-2013

11:01

x64

Sqmapi.dll

6.0.6000.16386

182,936

18-Aug-2013

11:26

x64

Jsproxy.dll

9.0.8112.20618

75,776

18-Aug-2013

10:00

x86

Wininet.dll

9.0.8112.20618

1,130,496

18-Aug-2013

10:02

x86

Wininetplugin.dll

1.0.0.1

66,048

18-Aug-2013

10:00

x86

Iertutil.dll

9.0.8112.20618

1,796,096

18-Aug-2013

09:59

x86

Sqmapi.dll

6.0.6000.16386

149,664

18-Aug-2013

10:18

x86


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.

Additional file information

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×