Thursday 15 March 2012

vbscript - How to run vbs in Internet Explorer -



vbscript - How to run vbs in Internet Explorer -

i'm trying run vbscript in net explorer, doesnt seem work. works when create .vbs file , double click, not on browser.

dim strwebsite strwebsite = "www.site.org" if pingsite( strwebsite ) wscript.echo "web site " & strwebsite & " , running!" else wscript.echo "web site " & strwebsite & " down!!!" end if function pingsite( mywebsite ) dim intstatus, objhttp set objhttp = createobject( "winhttp.winhttprequest.5.1" ) objhttp.open "get", "http://" & mywebsite & "/", false objhttp.setrequestheader "user-agent", "mozilla/4.0 (compatible; myapp 1.0; windows nt 5.1)" on error resume next objhttp.send intstatus = objhttp.status on error goto 0 if intstatus = 200 pingsite = true else pingsite = false end if set objhttp = nil end function

what right way ?

hot ms press: vbscript no longer supported in ie11 border mode (as knew, other browsers (that don't run on ms renderer) didn't run vbs anyway)

the 'correct' way translate javascript (no seriously, can still mock it's deprecated , advised update old code now), isn't hard since technique originated @ ms. you'd still head-request , check status-no.

this should started: http head request in javascript/ajax?

edit (addressing comment): don't count on reliably setting useragent though (that, above script, seems more thing of past):

https://bugzilla.mozilla.org/show_bug.cgi?id=627942 set request header in javascript xmlhttprequest , setrequestheader in ie returns error

edit2: see/think want somehow differentiate app: myapp 1.0; (in logs perhaps?). if that's case, might want add together custom headers instead: how can add together custom http header ajax request js or jquery?

also, server-logs (by default) pick on get-string, might want use/add-to (so wouldn't have alter log-format if custom header wouldn't show up)?

internet-explorer vbscript

No comments:

Post a Comment