Help Needed In Javascript

I am a total to programming newbie. Including php, html and javascript I have part of a program for retrieve the current location via javascript…using geolocation…

<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else { 
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude + 
"<br>Longitude: " + position.coords.longitude;
}
</script>

My problem is i need to get the current location’s Longtitude & Latitude information to generate a new web page link & load that new page … All this to be in javascript.

Example :
…new.php?w1=2.9272622,101.73036820000002
This new page is working perfectly… no problem.

Any Help Is Very Much Appreciated… Thank You In Advance From A Very Newbie…
Azlan

Hello there.

I am not sure if this is what you are looking for:
https://www.w3schools.com/jsref/met_win_open.asp

Hope this helps.

Hi… Thanks for the suggestion… but I am looking for more information… I want to modify the function Show Position…
I need To retrieve the longtitude , latitude info merged and generate example
new.php?w1=2.9272622,101.73036820000002 where the
2.9272622,101.73036820000002 is from the merged longtitude , latitude
then it need to load new web page new.php?w1=2.9272622,101.73036820000002

Would Very Much Appreciate any help… Thank You