Its so simple yet somehow I’ve done something wrong.
http://www.geoplugin.com/quickstart#how_to_geo-localize_your_visitors
The code in the above site works fine, it knows exactly where I am yet when I copy over the code to my webpage it doesn’t work.
In the head tag:
<script src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
In a div tag:
<script language="Javascript">document.write("function geoplugin_region() { return '"+ geoplugin_region()+"'; }");</script>
Returns:
function geoplugin_region() { return ”; }
The relevant part being ” in between the quotations a region should be displayed but its not.
(Both my webpage and the geoplugin were opened in internet explorer)
Any ideas?
For testing:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<title>Untitled Document</title>
</head>
<body>
<script language="Javascript">document.write("function geoplugin_region() { return '"+ geoplugin_region()+"'; }");</script>
</body>
</html>
UPDATE
So when others test the code on their computers it works fine
When I open other people’s pages that contains the geoplugin code it works fine
But if I open a website that is located in my harddrive it doesn’t work (both work and home computers)
Any ideas?
ANSWERED
EI (9) security settings were causing the problem I just had to convert the html to a hta and it works fine (I can’t actually change the security settings for IE here at work so that was not an option)
I upload you sources code as a html file to my server,and it return a true place where I live.
So,I think the geoplugin may use the XMLHttpRequest technology of AJAX.
Also,you can click http://hanasite.com/jscon/demo.html to checking.
Hope it can help you solve you problem. 🙂
(because of low reputation so I can’t upload a screenshot:()