6

Today when I tried to answer a question with a snippet it gave me a strange "Script error." message. I can run the sample code and it works, but I still get the error. Is this a bug or am I not understanding something about Stack Snippets?

$('.local-intranets').addClass('class');
.class {
  background-color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="local-intranets">
 Test
</div>

Image:

Screenshot #1 of snippet with error message

After edit by @suraj I can run the snippet in this question and still get the same error. I'm using Google Chrome, version 63.0.3239.132 (Official Build) (64-bit).

Screenshot #2 of snippet with error message

16
  • 8
    Its not repro in your question...
    – Suraj Rao
    Jan 24, 2018 at 6:40
  • 1
    When I run this code from question i still face same problem. I am using Google Chrome Version 63.0.3239.132 (Official Build) (64-bit)
    – 4b0
    Jan 24, 2018 at 6:43
  • 2
    I cant repro in Firefox stable or chrome stable.. both latest in WIndows. Also you meant this question right?
    – Suraj Rao
    Jan 24, 2018 at 6:44
  • What you see in browser console? (F12, go to tab console)
    – Grundy
    Jan 24, 2018 at 6:49
  • 1
    @Grundy Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': The document is sandboxed and lacks the 'allow-same-origin' flag.
    – 4b0
    Jan 24, 2018 at 6:50
  • @ShreeKhanal, this error usually happens when you try output to console jQuery object, are you sure that this not output from previous version code. Also, if you disable embedded console, you can see that error away
    – Grundy
    Jan 24, 2018 at 6:52
  • 1
    did you try without any extensions? maybe they are interfering?
    – Suraj Rao
    Jan 24, 2018 at 6:53
  • I am sure this is not output from previous version code.
    – 4b0
    Jan 24, 2018 at 6:53
  • I am not using any extensions.
    – 4b0
    Jan 24, 2018 at 6:55
  • 1
    @ShreeKhanal, can you try change jquery version to newer like 2.2.4 or even 3.x?
    – Grundy
    Jan 24, 2018 at 6:55
  • Anyway, if you uncheck Show console flag in snippet error should away even if you look in native browser console
    – Grundy
    Jan 24, 2018 at 6:57
  • @ShreeKhanal In what file does your browser report the error?
    – Ferrybig
    Jan 24, 2018 at 15:20
  • 3
    It's not reproducible by most of the people and even me, try to test the same link in different browser, incognito window(in chrome), clear your cache, and confirm if it's really causing a problem.
    – bhansa
    Jan 25, 2018 at 7:29
  • 1
    I found why I get error. Extension DuckDuckGo Privacy Essentials 018.1.25 .When I disable this extension error disappear.
    – 4b0
    Jan 29, 2018 at 6:19
  • 1
    It was happening to me, too. So it's DuckDuckGo's fault. Damn.
    – Phiter
    Feb 27, 2018 at 18:20

1 Answer 1

3

Extensions that are known to cause this problem:

Disabling the offending extension(s) should solve the problem.

1
  • 3
    I have the same problem and do not have this extension. So it can also be because of other extensions. It works when I disable my extensions. It's the Custom JavaScript for websites extension which breaks it in my case.
    – NtFreX
    Apr 12, 2018 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .