[OpenLayers-Users] Hyperlinked Features

palewire ben.welsh at gmail.com
Tue Feb 3 12:56:01 EST 2009


I've tried to come up with something similar myself -- and run into IE6
problems. My attempted solution was to use SelectFeature with a variety of
select and click functions like so

function show_feature(feature) {
        var selectedFeature = feature;
        var feature_name = selectedFeature.data.name;
        var hed = document.getElementById('feature-header');
        hed.innerHTML = 'Click to visit ' + feature_name;
}

function hide_feature() {
        var hed = document.getElementById('feature-header');
        hed.innerHTML = "Select a feature";
}

function click_feature(feature) {
        var selectedFeature = feature;
        var url = '/feature/' + selectedFeature.data.slug;
        window.location.href = url;
        return false;
}

var select = new OpenLayers.Control.SelectFeature(feature_vector, {
        hover: true,
        onSelect: show_feature,
        onUnselect: hide_feature,
        clickFeature: click_feature
});

index_map.addControl(select);
select.activate(); 

What's happening in IE6 is that the page works great on its initial load and
when I navigate between the maps using other parts of the HTML, but if I
click on one of the map links and then navigate back using the back button
the map will not reload correctly. IE6 seems to be throwing an error I can't
figure out on the click event that's sending the user to the next page. It
works perfectly fine that first time, but then all falls apart. I wish I
could figure this one out, because I feel like I'm close.

-- 
View this message in context: http://n2.nabble.com/Hyperlinked-Features-tp1824437p2264685.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list