I'am working with phonegap and I'am ecountering the problem that when I press the submit button from the user input it keeps opening the mobile browser, all i want is to open the website through the app not by opening the mobile browser, is there any way to resolve this issue?
Script:
function displayCam()
{
if (document.getElementById('ipadd').value.match(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)) {
var ip = document.getElementById('ipadd');
var portz = document.getElementById('portz');
//document.getElementById('camView').innerHTML = ip.value;
var link = document.getElementById('camView').href="http://"+ip.value+":"+portz.value;
window.location.href =link;
return(true);
}
else{
alert("You have entered an invalid IP address or Something is missing!")
document.getElementById('ipadd').value = "";
document.getElementById('portz').value = "";
return (false);
}
Code:
<center>
<br>
<br>
<h2>Please Enter IP Address</h2>
<table>
<tr>
<th><label for="ipadd">Enter IP Address:</label></th>
</tr>
<tr>
<td><input type="text" id= 'ipadd' placeholder="xxx.xxx.xxx.xxx" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" required" ></td>
</tr>
<tr>
<th><label for="portz">Enter Port:</label></th>
</tr>
<tr>
<td><input type='number' id='portz' pattern=".{1.4}" ></td>
</tr>
<tr>
<th><input type='button' onclick=' displayCam() ' value='Submit' required="required"></th>
</tr>
</table>
<div id="camView"> </div>
</center>