close button

5 replies·opened Apr 9, 2021
B
bagginsApr 9, 2021

Hello,

Can you please provide link in canvas demo pages that shows example of a button closing current page?

TIA

S
SemiColonWebSTAFFApr 9, 2021

Hello,

Apologies about the misunderstanding but we are not sure what you mean by this:
example of a button closing current page

Can you please provide us with an Example of what you are looking for so that we can provide you further assistance on this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

S
SemiColonWebSTAFFApr 10, 2021

Hello,

Canvas does not include any Default Code for this. You will need to use Custom JS Codes. Consider using these codes:

var myWindow;

function openWin() {
  myWindow = window.open("", "myWindow", "width=200,height=100");
  myWindow.document.write("<p>This is 'myWindow'</p>");
}

function closeWin() {
  myWindow.close();
}

Then you are using the following HTML Codes to Open/Close the Window:

<button onclick="openWin()">Open "myWindow"</button>
<button onclick="closeWin()">Close "myWindow"</button>

This should definitely work fine. Note that, you can close the Window that has also been opened by your JS Codes. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

B
bagginsApr 10, 2021

Unfortunately, no the window is not opened by js code. Is there another way to close window tab without this requirement?

S
SemiColonWebSTAFFApr 10, 2021

Hello,

Unfortunately, there is no other solution for this. The Custom JS will be blocked by the Browsers for security purposes.

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard