0

The window.close() method is not working in Chrome.

A "close" button exists in my Layout page with the JavaScript close method:

:javascript:window.open('', '_self','' );window.close();

<a  id="Close" href="javascript:window.open('', '_self','' );window.close();">Close</a>

When tried to call a controller method which returns the VIEW, on click of close button (which is in layout.cshtml) does not work. It throws an error:

Scripts may close only the windows that were opened by it.

This works correctly in cases like returning a partial view. IE has no issues.

alex
  • 6,818
  • 9
  • 52
  • 103
  • Please provide short example code showing the problem. – Ganesh Sittampalam Sep 06 '14 at 20:14
  • don't use javascript: label in href, instead use onclick handler (and don't use the javascript: label). See http://stackoverflow.com/a/11348403/61164 – Erik Funkenbusch Sep 06 '14 at 20:27
  • tried removing href, added event handler , but no luck. – Wcf Wcf Sep 07 '14 at 06:17
  • tried removing href, added event handler , but no luck. (Layout.cshtml) @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") Close – Wcf Wcf Sep 07 '14 at 06:27

0 Answers0