3

We have an extension that needs to fire on every page the user loads. We have tried to accomplish this using domain ".*" in the dispatch block. While this works great in firefox and chrome, IE doesn't respect this at all.

Is this a known issue or are there any work arounds to the domain ".*"? Unfortunately we are in a unique situation where we can't list all the domains we want to fire our extension on.

trumans1
  • 183
  • 2
  • 10

1 Answers1

4

Looks like I found the answer to my own question.

It doesn't look like the Kynetx IE version supports this out of the box. It's currently using the c# function:

if (document.domain.EndsWith(domain))
{
    plantTags = true;
    break;
}

plantTags is a flag used to show put the extension code on the page or not. EndsWith just sees if the current string (document.domain) ends with whatever you pass it. Knowing this, you could put in domain ".com" domain ".net" etc and it should work on all pages, though I didn't test this.

Instead, I just used regex by adding this at line 6 in the file BHO/BHO.cs:

using System.Text.RegularExpressions;

And then changing lines 182-190 from:

foreach (String domain in domainlist)
{
    //reportMessage("onDocComplete", "Matching " + domain + " to doc domain " + document.domain);
    if (document.domain.EndsWith(domain))
    {
        plantTags = true;
        break;
    }
}

To:

foreach (String domain in domainlist)
{
    Regex objDomainPattern = new Regex(domain);
    //reportMessage("onDocComplete", "Matching " + domain + " to doc domain " + document.domain);
    if (objDomainPattern.IsMatch(document.domain))
    {
        plantTags = true;
        break;
    }
}

From there I just had to re-compile the extension code (instructions are included with the source download on how to do this) and I was off! My IE extension now will do a match based on a regex from the domain block. Hope this helps someone else out someday!

trumans1
  • 183
  • 2
  • 10