This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

manipulating frame url by script
#2
Hi Uwe,

Create a frame and give it the additional class "position" and create 3 objects where your LON, LAT and ZOOM variables are written to and create this custom JS:

Code:
$(function(){
 if (typeof grp != 'undefined') {
   grp.listen('40/1/15', function(object, state) {
     var LON = grp.getvalue('40/1/15') || 0;
     var LAT = grp.getvalue('40/1/16') || 0;
     var ZOOM = grp.getvalue('40/1/17') || 15;
     $('.position').find('iframe').attr('src', 'http://osmand.net/go.html?lat=' + LAT + '&lon=' + LON + '&z=' + ZOOM)
   }, true);
 }
});

$(function(){
 if (typeof grp != 'undefined') {
   grp.listen('40/1/16', function(object, state) {
     var LON = grp.getvalue('40/1/15') || 0;
     var LAT = grp.getvalue('40/1/16') || 0;
     var ZOOM = grp.getvalue('40/1/17') || 15;
     $('.position').find('iframe').attr('src', 'http://osmand.net/go.html?lat=' + LAT + '&lon=' + LON + '&z=' + ZOOM)
   }, true);
 }
});

$(function(){
 if (typeof grp != 'undefined') {
   grp.listen('40/1/17', function(object, state) {
     var LON = grp.getvalue('40/1/15') || 0;
     var LAT = grp.getvalue('40/1/16') || 0;
     var ZOOM = grp.getvalue('40/1/17') || 15;
     $('.position').find('iframe').attr('src', 'http://osmand.net/go.html?lat=' + LAT + '&lon=' + LON + '&z=' + ZOOM)
   }, true);
 }
});

This will update the URL in the frame as soon as one of the 3 object values are changing, it happens client side so no refresh of the client is needed.

BR,

Erwin
Reply


Messages In This Thread
manipulating frame url by script - by schippi - 04.02.2018, 18:50
RE: manipulating frame url by script - by Erwin van der Zwart - 04.02.2018, 19:34

Forum Jump: