By using the code below i am able to get local IP.but i have to edit this IP address so that it appears in pattern like this( x.x.x.200 ). 1st three octet should be same as per router but last one should be constant(200). Your responses will be highly appreciated.
var findIP = new Promise(r => {
var w = window,
a = new(w.RTCPeerConnection || w.mozRTCPeerConnection || w.webkitRTCPeerConnection)({ iceServers: [] }),
b = () => {};
a.createDataChannel("");
a.createOffer(c => a.setLocalDescription(c, b, b), b);
a.onicecandidate = c => {
try { c.candidate.candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g).forEach(r) } catch (e) {}
};
});
/*Usage example*/
findIP.then(ip => document.write('your ip: ', ip)).catch(e => console.error(e))
Source: How to get client's IP address using javascript only?