Close button not working

I have the following code to close a browser window when clicked on, I am using chrome but it is not doing anything.

<input name="Btnclose" type="button" class="bodytext" id="Btncancel" onClick="parent.window.close()" value="    Close    ">

Anything missing ?
AleksAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GaryConnect With a Mentor Commented:
JavaScript is not allowed to close a window it did not open.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
I'm not conversant with Chrome's security settings, but I wouldn't be surprised if there were a setting to either disable javascript, or to prevent this type of javascript from running.

Does the code work in other browsers?

Does the code work with Chrome on other machines?
0
 
AleksAuthor Commented:
I will check.
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
is this browser window a child window or just the main window? if it's just the main window(), try just doing window.close()
0
 
AleksAuthor Commented:
If it wasn't opened that way how can I just close a window not opened by javascript ?
0
 
GaryConnect With a Mentor Commented:
Click the X
Or in the window itself run self.close()
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Can you describe what this is for and how it is opened in the first place?  Is this a pop up or a modal?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.