Javascript error on oauth/authorize


I’m just writing a client app (win/c#) that will allow the user to tweet a message & photo. I’m using framework’s functions for oauth handling, and the webbrowser control to show the web pages, and it all works almost great. The almost part is that when the browser navigates to, it throws up a javascript error:

Line: 177
Char: 5
Error: Unable to get value of the property 'contains': object is null or undefined.
Code: 0

Do you want to continue running scripts.

Either yes or no doesn’t matter, I can still sign in and authorize the app, but it’s very annoying. Looking at the html that was sent to the browser, the offending function appears to be:

function($) {
$(‘a’).each(function (i, link) {

if (link.classList.contains('register')) return; = "_blank";


And, given that not all of the tags have classes, I’m guessing that is the cause for this. Of course, the real cause may be that the browser engine used by c# is really IE (shudder), but I don’t have much choice in that department.

Has anyone else seen this, and if it is a problem with the page being sent down, is there anything I can do to fix it, short of monkey-patching the html as it arrives?


You should really be opening this sequence in a dedicated web browser – we don’t explicitly support embedded web views – you definitely should not modify the HTML, as that would be seen as tampering with the auth process.


This is going on a self-serve kiosk, so giving the user an open browser is a non-starter - either it works in a controlled environment or it doesn’t go in the app. Why not just fix the js so it checks for undefined? It wouldn’t hurt anything to change the code on the page:

function($) { $('a').each(function (i, link) {
if ((typeof link.classList != 'undefined') && (link.classList.contains('register'))) return; = "_blank";


I’ll mention again that the auth process works, it’s just the html being sent down has a bug that this particular rendering engine is sensitive to.


Apologies, that JavaScript should only have been served to IE10 OAuth broker user agents. I’ll roll a fix.


That would be great - thanks!


I’m getting the same error only on IE 9. The line “link.classList.contains(‘register’)” works fine on Chrome and Firefox.
Is there any fix for this issue?