Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dispatch of domain .* doesn't work in IE

Tags:

krl

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.

like image 306
trumans1 Avatar asked Jan 29 '26 05:01

trumans1


1 Answers

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!

like image 119
trumans1 Avatar answered Feb 01 '26 00:02

trumans1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!