I am trying to disable the address bar. I used the "location=no" parameter in the window. open method, but it is not working. could you please help on this issue?
Below is my source code. Please check and help me on this.
First HTML ( From this page I am opening second page in new window)
<html>
<script>
</script>
<body>
<h1>The a element</h1>
<a href="target.htm" onclick="window.open('https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_close', '', 'toolbar=no, directories=no,location=no, status=yes, menubar=no,resize=no, scrollbars=yes');">Open New Window</a>
</body>
</html>
Second Html : (In new window this HTML page will open)
<html oncontextmenu="return false;">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" >
<style>
</style>
<script >
// window.open('file:///C:/Users/Karthik.Ch/Documents/docView.html','winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');
function myFunction() {
// window.resizeTo(1024,750);
}
document.onkeypress = function (event) {
event = (event || window.event);
return keyFunction(event);
}
document.onmousedown = function (event) {
event = (event || window.event);
return keyFunction(event);
}
document.onkeydown = function (event) {
event = (event || window.event);
return keyFunction(event);
}
//Disable right click script
function clickIE() {
if (document.all) {
alert("Sorry, right-click has been disabled");
return false;
}
}
function clickNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {
alert("Sorry, right-click has been disabled");
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
}else{
document.onmouseup=clickNS;
document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function("return false")
function keyFunction(event){
//Ctrl+Shift+I
if (event.ctrlKey && event.shiftKey && event.keyCode == 73) {
alert('The action you performed is unauthorized. Copying any content from this website is restricted');
return false;
}
//Ctrl+Shift+J
if (event.ctrlKey && event.shiftKey && event.keyCode == 74) {
alert('The action you performed is unauthorized. Copying any content from this website is restricted');
return false;
}
//Ctrl+Shift+U
if (event.ctrlKey && event.keyCode == 85) {
alert('The action you performed is unauthorized. Copying any content from this website is restricted');
return false;
}
//Ctrl+V
if (event.ctrlKey && event.keyCode == 86) {
alert('The action you performed is unauthorized. Copying any content from this website is restricted');
return false;
}
//F12 || S || F5 || Insert || P || Z || right window key || Windows Menu / Right || Delete || Print Screen || Shift || Alt || Print || Refresh || C || Ctrl || event.keyCode == 67 || event.keyCode == 17
if (event.keyCode == 123 || event.keyCode == 83 || event.keyCode == 116 || event.keyCode == 45 || event.keyCode == 80 || event.keyCode == 91 || event.keyCode == 92 || event.keyCode == 93 || event.keyCode == 46 || event.keyCode == 44 || event.keyCode == 16 || event.keyCode == 18 || event.keyCode == 42 || event.keyCode == 168 ) {
alert('The action you performed is unauthorized. Copying any content from this website is restricted');
return false;
}
}
function closeWindow(){
//setTimeout('window.close()', 300000)
}
</script>
</head>
<body onload="closeWindow()" onresize="myFunction()" oncopy="return false;" onpaste="return false;" oncut="return false;">
<iframe style="width:1024px" height="750" src="https://www.w3schools.com/jsref/met_win_open.asp"></iframe>
<div style="width:1020px;height:750px;background-color:transparent;position:absolute;top:0px;max-width: 100%;">
</body>
</html>