#206419 - 2012-12-09 02:19 AM
Inconsistent Results using InternetExplorer.Application
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4574
Loc: USA
|
Using the InternetExplorer.Application object I was able to get the "real" user agent IE displays. The problem is the results are very inconsistent. Sometimes I get the user agent returned correctly, and other times it is blank.
function GetIEUserAgent()
dim $ie,$page
$ie=createobject("InternetExplorer.Application")
$ie.navigate("http://whatsmyuseragent.com/")
while $ie.busy and $ie.readystate <> 4 loop
if $ie.document
$page=split($ie.document.documentelement.innerhtml,chr(10))
for $i=0 to ubound($page)
if instr($page[$i],"Your User Agent:</strong>")
$GetIEUserAgent=trim(split(split($page[$i],"Your User Agent:</strong>")[1],"<")[0])
endif
next
endif
$ie.quit
endfunction
I also tried
while $ie.busy and $ie.readystate <> 4 and @error=0 loop but it didn't help.
When it fails, this is all it gets, instead of a full page of html that has the user agent in it:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Whats My User Agent?</title>
<meta name="description" content="Check your web browser User Agent instantly, a
long with the full header, Forwarded IP (for proxy service), IP to Country Conve
rsion, HTTP Referer, HTTP_X_FORWARDED_FOR and more!!!">
<meta name="keywords" content="what is my user agent Web browser client header I
P Address HTTP_X_FORWARDED_FOR User agent string local identifier IP to Country
IP-to-Country IP2Country Conversion HTTP Referer HTTP Referrer">
<link href="favicon.ico" rel="shortcut icon">
<link href="Main.css" rel="stylesheet" type="text/css"></head>
Any ideas?
_________________________
(... better days ahead)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|