Categories
Coding Websites

Stop CloudFlare from injecting beacon

I have a client that uses CloudFlare, which I recommend, not only because I approve of their service, having been using it since they started up, but I love how they are fighting patent trolls!

So where was I? Oh, right! The client turned on Web Analytics which started causing a ruckus with some pages that provided API-like responses to certain automated functions by injecting a link of code to the rendered html output.

So in this case we turned off “automatic setup” for that site using CF dashboard -> analytics & logs -> web analytics -> manage site link

Now I bet there is another more elegant solution like making sure the page outputs a different content-type or something that would prevent this, but for a quick fix on this issue, doing the above works.

Categories
Websites Windows

Windows Media Keyboard Keys Not Working

I have a windows box I use for certain things, and on it I have a music player that plays from my local library and I use the keyboard play/pause/next/prev buttons to control it.

But recently I found these keyboard buttons were refusing to work! After much diagnoses it turns out that Chrome was over-riding the functions, Now this is actually helpful if you are using Google Music or other music players in the browser. But if you want to disable that so your other player takes control you need to go to: chrome://flags/

And search for “hardware media” and disable that! Hopefully that helps someone from music player frustration syndrome.

Categories
Websites

Google Chrome Show Full URL

One of Chrome’s recent updates hides the protocol name (HTTP/HTTPS) and the WWW prefix from the URL when the address bar is not focused.This can be confusing if you trying to test different http/https setups and need to see the designation in the URL bar.

To fix that you can visit chrome://flags/#omnibox-ui-hide-steady-state-url-scheme-and-subdomains

And do a search on “ui hide” — I personally disabled all 3 of the options that showed up, but you can pick and choose to your liking.

Categories
Coding Websites

Applying callback to grecaptcha

We were having some troubles with some users rushing to click the submit button on a form immediately after clicking the good ‘ole “I’m not a robot” checkbox, instead of waiting nicely for the captcha to verify. By the way, that is TOTALLY what a robot would do, so it’s probably good that it fails the verification.

But to get the submit button to only enable after the checkbox turns green, you need to provide a “callback” routine for the grecaptcha. And, you can also provide a “expired-callback” routine for if the captcha box sits around too long after a check and then turns red. Note that you need to put the defined callbacks without quotes.

Also to add some complexity, we had two separate captchas in our page, so we had to define two of them. Some people have reported troubles doing so, but our final solution worked.

We had a problem where the callback routines were not being called, but everything else was working — it turns out we have the callback functions defined AFTER the render, and moving them before that section made everything work. So, the final layout:

<script src=”https://www.google.com/recaptcha/api.js?onload=myCaptInit&render=explicit” async defer></script>
<script>
var myCaptInit = function() {
var buton11 = function() {
$(“#mainsubmit”).removeAttr(“disabled”);
};
var butoff11 = function() {
$(“#mainsubmit”).attr(“disabled”, “disabled”);
};
grecaptcha.render(‘recaptcha11’, {
‘sitekey’: ‘xxxx’,
‘callback’: buton11,
‘expired-callback’: butoff11,
‘size’: ‘compact’
});
grecaptcha.render(‘recaptcha10’, {
‘sitekey’ : ‘xxxx’,
‘size’ : ‘compact’
});
};
</script>

Categories
Unix Websites

Disable search in google chrome address bar

I dislike how Chrome has turned the address bar (also known as a “location bar” or “URL bar”) into an “Omnibox”. Since I run Chrome on my Linux box, and I have a bunch of test hosts defined in my /etc/hosts file, everytime I try to shortcut by just typing a dev hostname, Google pops up a damn search result!

There are some posted methods to avoid this. One was to check chrome://flags, which does have a bunch of nice settings, however my version of Chrome DID NOT have the one to do this!

Instead I found that creating my own search engine option was the solution. Go to chrome://settings/ and choose “Manage Search Engines”. In there, add a new one with “none”, “null” and “http://%s” as the options.

Boom! No more annoying forced search! Suck it, Omnibox!

OK, deep breath.

Categories
Websites

Amazon S3 forcing streaming or download

When you upload MP3 files into AWS S3, they will default to being a content-type that browsers will treat as a download (I believe “octet-stream”). If you want to change this so the delivery will be streaming, you need to change the content-type to “audio/mpeg” via the AWS console by editing “Properties” -> “Metadata”:

And if you want to revert back to forcing download, just remove the content-type metadata — note that there is no pulldown value for octet-stream!

Categories
Websites

Bootstrap Button Text Word Wrap

Using bootstrap to display button pulldowns, http://getbootstrap.com/components/#btn-dropdowns, I had trouble getting the text to wrap and make the button taller as needed. The fix was adding this to the CSS for the button!

white-space: normal;

Categories
Websites

Change back to the old Google icon

My opinion is that Google made a huge mistake with the new name “Alphabet” — they should fire the marketing people behind that concept, who no doubt must have had a bad experience mixing Redbull, Ecstasy, and AlphaBits. I mean, hey, I get it, when in Vegas — but wait until after you sober up before renaming the company.

Anywho, the thing that really gets me upset is now there is some new horrible favicon that google uses and it looks out of place on my chrome browser tabs now. This new google icon is distracting, too busy, and insults any reasonable sense of aesthetic. So, here is how to change it back!

Download the Favicon Changer chrome extension (I use chrome, but I think there are versions for other browsers if you look around). Visit google.com, and when you use the extension you’ll have to give it a URL to your chosen favicon, I have a sample on at http://dougco.com/678934759.png — if you don’t want to see a broken https link for https sites, you’ll need to give a SSL URL, like https://dougco.com/678934759.png

There, now your browser tabs are more serene.

Categories
Websites

Google Maps API stopped working on IE

Just got reports today from customers that websites with Google Maps Javascript API stopped working, and it seems Google made some changes a day or so ago.

I found a link that had helpful information, http://stackoverflow.com/questions/28582943/google-maps-v3-19-wont-load-using-embedded-vb6-browser and the exact fix that worked for me was adding this META tag:

<meta http-equiv=”X-UA-Compatible” content=”IE=EDGE” >

Categories
Unix Websites

Webmail on Linux

I maintain my own mail server and for cases where I can’t easily connect directly with an IMAP mail client, I use a webmail interface.

I’ve been using SquirrelMail for a while, and just recently installed Roundcube webmail which looks worlds better!

The only drawback is that it does not have vacation plugin that works right away with Dovecot, so I’m still playing around with that functionality…