# How to use web viewer get ip?

**URL:** <https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920>\
**Category:** Questions about Thunkable X\
**Tags:** webviewer\
**Created:** [July 6, 2021, 1:29pm UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920 "2021-07-06T13:29:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 6, 2021, 1:29pm UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/1 "2021-07-06T13:29:59Z")

</div>

How to use web viewer get ip?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 6, 2021, 4:33pm UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/2 "2021-07-06T16:33:49Z")

</div>

Which IP?

You can use one of the `device` library of f JavaScript to get info about your device including the IP.

---

<div class="post-metadata">

**Author:** ![jaythemanchs](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jaythemanchs/32/92809_2.png) [@jaythemanchs](https://community.thunkable.com/u/jaythemanchs)\
**Post date:** [July 7, 2021, 12:44am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/3 "2021-07-07T00:44:28Z")

</div>

Use this,

```auto
<!DOCTYPE html>
<html>
<head>
  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

  <script src="https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js" type="text/javascript"></script>

</head>
<body>
  
  <script>
  $.getJSON('https://api.ipify.org?format=jsonp&callback=?', function(data) {
    console.log(JSON.stringify(data, null, 2));
    ThunkableWebviewerExtension.postMessage(JSON.stringify(data, null, 2));

  });
  </script>

</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 7, 2021, 3:27am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/4 "2021-07-07T03:27:59Z")

</div>

> [@jaythemanchs](#):
>
> ```auto
> <!DOCTYPE html>
> <html>
> <head>
>   
> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
> 
> <script src="https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js" type="text/javascript"></script>
> 
> </head>
> <body>
>   
> <script>
> $.getJSON('https://api.ipify.org?format=jsonp&callback=?', function(data) {
> console.log(JSON.stringify(data, null, 2));
> ThunkableWebviewerExtension.postMessage(JSON.stringify(data, null, 2));
> 
> });
> </script>
> 
> </body>
> </html>
> 
> ```

Thanks.

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 7, 2021, 3:55am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/5 "2021-07-07T03:55:39Z")

</div>

Successfully used

 ![圖片](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/3/2360042a0f35c0620ab1bf8be14ed782ee2e6196.jpeg)

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 7, 2021, 3:59am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/6 "2021-07-07T03:59:57Z")

</div>

How to use ip to know the geographic location?

---

<div class="post-metadata">

**Author:** ![jaythemanchs](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jaythemanchs/32/92809_2.png) [@jaythemanchs](https://community.thunkable.com/u/jaythemanchs)\
**Post date:** [July 7, 2021, 5:12am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/7 "2021-07-07T05:12:08Z")

</div>

Try this,

```auto
<!DOCTYPE html>
<html>
<head>
  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

  <script src="https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js" type="text/javascript"></script>

</head>
<body>
  
  <script>
  $.getJSON('https://api.ipify.org?format=jsonp&callback=?', function(data) {
    fetch('http://www.geoplugin.net/json.gp?ip=' + JSON.parse(JSON.stringify(data, null, 2)).ip)
    .then(response => response.json())
    .then(data => ThunkableWebviewerExtension.postMessage(data));
  });
  </script>

</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 7, 2021, 10:43am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/8 "2021-07-07T10:43:38Z")

</div>

no response.

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 8, 2021, 7:30am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/9 "2021-07-08T07:30:06Z")

</div>

I found that there is no need to use the web viewer, just use the web api directly:  
[https://api.ipify.org/?format=jsonp&callback=](https://api.ipify.org/?format=jsonp&callback=)  
[http://www.geoplugin.net/json.gp?ip=](http://www.geoplugin.net/json.gp?ip=)  
From your (@jaythemanchs ) html.

---

<div class="post-metadata">

**Author:** ![jaythemanchs](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jaythemanchs/32/92809_2.png) [@jaythemanchs](https://community.thunkable.com/u/jaythemanchs)\
**Post date:** [July 8, 2021, 7:33am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/10 "2021-07-08T07:33:08Z")

</div>

Cool. 👍 Happy Coding

---

<div class="post-metadata">

**Author:** ![tony.ycy.program](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tony.ycy.program/32/100153_2.png) [@tony.ycy.program](https://community.thunkable.com/u/tony.ycy.program)\
**Post date:** [July 8, 2021, 7:35am UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/11 "2021-07-08T07:35:07Z")

</div>

Will the ip be hidden? Or change?

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:19pm UTC](https://community.thunkable.com/t/how-to-use-web-viewer-get-ip/1381920/12 "2024-11-08T13:19:58Z")

</div>


