ReferenceError when getting .src with script element in different domain #6

Closed
lessmind opened this Issue Feb 14, 2012 · 0 comments

1 participant

@lessmind

Hi, this issue happend when there's some script source not in the same domain.
Like now I'm in http://abc.com, but the script is at http://ijk.com/some.js, and when I access its src like

    console.log(window.document.getElementsByTagName('script')[2].src)

Then I got errors here.

Actually they are all in the same block, so I post these together.

/path/to/domino/lib/URL.js:18
                var pos = S.lastIndexOf(match[4], ":");
                          ^
ReferenceError: S is not defined

/path/to/domino/lib/URL.js:19
                this.host = substring(match[4], 0, pos);
                            ^
ReferenceError: substring is not defined

/path/to/domino/lib/URL.js:20
                this.port = substring(match[4], pos+1);
                            ^
ReferenceError: substring is not defined

Maybe there should be some utilities been required in this module, but I can't find it though, now I modified it, and not sure if I made any other mistakes. Hope I can have some solutions here.

The original:

    var pos = S.lastIndexOf(match[4], ":");
    this.host = substring(match[4], 0, pos);
    this.port = substring(match[4], pos+1);

Modified:

    var pos = match[4].lastIndexOf(':');
    this.host = match[4].substring(0, pos);
    this.port = match[4].substring(pos+1);
@fgnass fgnass added a commit that referenced this issue Feb 14, 2012
@fgnass Fixed issue #6 becf66a
@lessmind lessmind closed this Feb 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment