Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

One site that I use has a browser check that it performs, and because my browsers indicate that they're Linux, and not Windows or Mac it pops up (on every page) a warning that I'm using an "unsupported" OS.
I've tried falsifying the user agent, but Chrome seems to not be saving that setting, and user-agent switcher extensions seem to be ineffective.

The browser detection appears to be bundled into a single javascript file. So, I figure if I can blacklist or ban that file then it'll stop bugging me about my "unsupported" OS.

So, how would I go about blacklisting or banning that file? Solutions that work for multiple browsers are a bonus.

share|improve this question
    
Can you post a link to that page? –  sudo Feb 13 '13 at 23:57
    

2 Answers 2

up vote 1 down vote accepted

You can achieve the same result with a user script. It won't prevent the external JavaScript from loading, but it will disable the JavaScript functions alert() and confirm(). Removing the banner with JavaScript could cause flickering, but you can inject CSS to hide it.

User script

// ==UserScript==
// @name        No Nagging
// @description Disables nagging on harrison.edu
// @version     1.2
// @include     *://harrison.edu/*
// @include     *://*.harrison.edu/*
// @run-at      document-start 
// ==/UserScript==

var script = document.createElement('script');
var style = document.createElement('style');

script.appendChild(document.createTextNode(
    'window.alert=function(){};' + 
    'window.confirm=function(){};'
));

style.appendChild(document.createTextNode(
    '.topmenubar{display:none;}'
));

var interval = setInterval(function() {
    if (document.head) {
        document.head.appendChild(script);
        document.head.appendChild(style);
        clearInterval(interval);
    }
}, 10);

How it works

The first four instructions create <script> and <style> elements. The JavaScript inside <script> replaces the global functions alert() and confirm() with empty functions; the CSS inside <style> hides the banner.

<script>
    window.alert=function(){};
    window.confirm=function(){};
</script>

<style>
    .topmenubar{display:none;}
</style>

Next, we create an interval that checks every 10 ms in the <head> element already exists.

When it does, we append the created elements to <head> and cancel the interval.

How to install

  1. Save the script as no-nagging.user.js.

    • Open chrome://extensions.

    • Drag no-nagging.user.js into the open tab.

    OR

    • Close Chrome and reopen it by executing the following command:

      google-chrome --easy-off-store-extension-install
      
    • Drag no-nagging.user.js into the address bar.

  2. Click Add.

share|improve this answer
    
Is there a way to also remove (if present) the span block with id=IsSupportedPlatform ? I think that would be better than having to use an adblock extension, which I guess I trust fairly well, but I'd prefer to not use if I don't have to. –  killermist Feb 14 '13 at 3:52
    
I've updated my answer. –  sudo Feb 14 '13 at 12:16
    
hmmm. If I drag and drop the file anywhere but the address bar on chrome:/extensions (singular doesn't exist) it does nothing. Dropped to the address bar, I get img441.imageshack.us/img441/6315/userjsproblem.png whose link leads to support.google.com/chrome_webstore/bin/… So, I'm kind of stuck on how to proceed. I remember with Opera, adding .user.js files was as simple as just putting them in the right directory. Google seems to love making Chrome more complicated, I guess. –  killermist Feb 14 '13 at 13:53
    
That might depend on the GUI. Dragging works in Unity. I've added a second approach. –  sudo Feb 14 '13 at 14:10
    
Excellent. Using google-chrome --easy-off-store-extension-install to get it loaded works. It still shows the banner, but the banner has no content, which I'm happy with. The ad blocker was able to surgically remove the whole banner (treating it as an ad). –  killermist Feb 14 '13 at 16:21

You could use an ad-blocker like AdBlock. You can then block the file by its URL.

share|improve this answer
    
Nifty. Looks like a total of 2 rules were all I needed. One to remove the text warning that was displaying and another to block the file. –  killermist Feb 14 '13 at 0:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.