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 whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dynamically editing a html page
#1
I'm new at this but loving what I am seeing. I'm trying to take my current lat/long and make a local html file along these lines Embed VesselFinder map into your website - VesselFinder

Essentially it's just take this:
<script type="text/javascript">
   // Map appearance
   var width="100%";         // width in pixels or percentage
   var height="300";         // height in pixels
   var latitude="36.00";     // center latitude (decimal degrees)
   var longitude="-5.40";    // center longitude (decimal degrees)
   var zoom="8";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>



and replace the lat/long with my current position and change the zoom to my preferred. See attached.
My problem is that when I debug and copy the generated text to a new html file on my desktop it works great. When I click on the generated button it takes me to the vesselfinder page but doesn't do any of the customisations. What am I doing wrong?

Cheers


Attached Files
.txt   ShowAISDataOnVesselFinderForMyCurrentLocation.json.txt (Size: 2.98 KB / Downloads: 20)
Reply
#2
(2022-05-31, 09:21 PM)marty_c Wrote: I'm new at this but loving what I am seeing. I'm trying to take my current lat/long and make a local html file along these lines Embed VesselFinder map into your website - VesselFinder

Essentially it's just take this:
<script type="text/javascript">
   // Map appearance
   var width="100%";         // width in pixels or percentage
   var height="300";         // height in pixels
   var latitude="36.00";     // center latitude (decimal degrees)
   var longitude="-5.40";    // center longitude (decimal degrees)
   var zoom="8";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>



and replace the lat/long with my current position and change the zoom to my preferred. See attached.
My problem is that when I debug and copy the generated text to a new html file on my desktop it works great. When I click on the generated button it takes me to the vesselfinder page but doesn't do any of the customisations. What am I doing wrong?

Cheers

Ended up being a lot easier than I thought. I just created global variables for latitude and longitude and then used this.

<script type="text/javascript">
    // Map appearance
    var width="100%";         // width in pixels or percentage
    var height="600";         // height in pixels
    var latitude={{global.latitude}};
    var longitude={{global.longitude}};
    var zoom="13";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)