Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Sheiles 60 posts 284 karma points
    Nov 24, 2014 @ 00:07
    David Sheiles
    0

    Stopped working - 404 on external .js reference

    Hi,

    Seek and destroy has been running really well on our site for some time, however it's stopped working all of a sudden.

    There seems to be a reference to http://j.maxmind.com/app/geoip.js  in seek and destroy and the file is coming back with a 404 error which is causing the page to break.

    Anyone have the same issue. Any ideas on how to resolve.

    Thanks

    David

  • Yannick Smits 321 posts 718 karma points
    Nov 27, 2014 @ 00:07
    Yannick Smits
    0

    Yes same here. Looks like it's a payed service now. Looking into other free services now. Will keep you posted.

  • David Sheiles 60 posts 284 karma points
    Nov 27, 2014 @ 01:22
    David Sheiles
    0

    Thanks, Yes looks like it.

    I'm going to look at modifying it to use google maps geo location. I'll let you know how it goes.

  • David Sheiles 60 posts 284 karma points
    Nov 27, 2014 @ 07:25
    David Sheiles
    0

    Hi Yannick,

    I removed the maxmind script and updated some of the code to use geolocation and it works fine. Not quite a well as using the maxmind geoip script because the user has to accept the request to get thier location, but still works fine.

    I've used open street maps, to pull the postcode from thier location to use as the address

    I had previously modified the original script a while back, so not sure if its much different than the stock code, but it should be able to help you update your site.

    at the beginning of the inline script:

    var map;
    var geocoder;
    
    var markers = new Array();                    
    var address = '';
    //$('#address').val(geoip_city() + ", " + geoip_country_name());
    //var address = $('#address').val();
    if (address != '') {
        gmap_location_lookup(address);
    }else{
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position){
                $.ajax({
                  dataType: "json",
                  url: "http://nominatim.openstreetmap.org/reverse?format=json&lat="+position.coords.latitude+"&lon="+position.coords.longitude+"&zoom=18&addressdetails=1",
                  data: {},
                  success: function(data){
                    address = data.address.postcode;
                      $("#address").val(address);
                      gmap_location_lookup(address);
                  }
                });
            },  function(error){
            },{
                enableHighAccuracy: false     
            });
        } 
    }
    
    You can see the fully functioning site here - http://savour-life.com.au/find-us/

    Hope that helps point you in the right direction.

    Cheers,

    Dave

  • Yannick Smits 321 posts 718 karma points
    Nov 27, 2014 @ 15:09
    Yannick Smits
    101

    Ok we changed to a different lib with minimal change. Just removed the reference to the maxmind lib and then updated the code as follows (red is removed, green is added):

    and then later update this line with the new function name:

    geocoder.geocode({ 'address': address, 'region': countryCode }, function (results, status) {

  • David Sheiles 60 posts 284 karma points
    Dec 01, 2014 @ 06:23
    David Sheiles
    0

    Thanks Yannick.

    I think what I've got will do for what I need, but your solution does looks like a better solution. I'll check out ip-api.com for future projects as it looks good.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies