I want all my web app pages (Google app script )to be at same tab some thing like target = "_self"
but that did not work.
when I'm am in the page index and I click the link it es work without problem and now I'm in index2 when I click at the buttom nothing happen only white empty page is there. someone can help me please!
I will show you the code
\\code.gs
function doGet(e) {
if(e.parameters.v == "index2")
return test2();
else return test();
}
function test(){
return HtmlService.createTemplateFromFile('Index').evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
function test2(){
return HtmlService.createTemplateFromFile('Index2').evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
index.html
<!DOCTYPE html>
<html>
<head>
<style>
.iframe{
display: none;
}
.fullScreen {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<body>
<button class="btn waves-effect waves-light" id="btn"> to Index 2 </button>
<script>
document.getElementById("btn").addEventListener("click", fireOff);
function fireOff(){
window.open(
"<?= ScriptApp.getService().getUrl(); ?>?v=index2"
,"_self");
}
</script>
</body>
</html>
index2.html
<!DOCTYPE html>
<html>
<head>
<base target="_self">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<body>
<h1> Hi i am iFrame </h1>
<button class="btn waves-effect waves-light" id="btn">to Index 1 </button>
<script>
document.getElementById("btn").addEventListener("click", fireOff);
function fireOff(){
window.open(
"<?= ScriptApp.getService().getUrl(); ?>?v=inde2"
,"_self");
}
</script>
</body>
</html>