Created
March 21, 2012 11:24
-
-
Save martijnvogten/2146303 to your computer and use it in GitHub Desktop.
load binary file in IE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) { | |
var IEBinaryToArray_ByteStr_Script = | |
"<!-- IEBinaryToArray_ByteStr -->\r\n"+ | |
"<script type='text/vbscript'>\r\n"+ | |
"Function IEBinaryToArray_ByteStr(Binary)\r\n"+ | |
" IEBinaryToArray_ByteStr = CStr(Binary)\r\n"+ | |
"End Function\r\n"+ | |
"Function IEBinaryToArray_ByteStr_Last(Binary)\r\n"+ | |
" Dim lastIndex\r\n"+ | |
" lastIndex = LenB(Binary)\r\n"+ | |
" if lastIndex mod 2 Then\r\n"+ | |
" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n"+ | |
" Else\r\n"+ | |
" IEBinaryToArray_ByteStr_Last = "+'""'+"\r\n"+ | |
" End If\r\n"+ | |
"End Function\r\n"+ | |
"</script>\r\n"; | |
// inject VBScript | |
document.write(IEBinaryToArray_ByteStr_Script); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment