Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Closing a window using javascript

I am using the self.close() method to close a popup window. I keep getting a message saying "The webpage you are viewing is trying to close the window. Do you want to close this window?" Is there any way to just have the window close without this message popping up? Suggestions would be great or a link to a tutorial.
0
apriigem
Asked:
apriigem
  • 8
  • 6
1 Solution
 
RoonaanCommented:
You can only close windows that are opened using javascipt.
Try to open the popup using window.open, rather than target="_blank".

-r-
0
 
apriigemAuthor Commented:
I don't know if that will work. I opened the window from Flash. I have a form that I created in Flash that sends and email with some information in it. Is there a way to make that work with Flash?
0
 
Kiran Paul VJComputer EngineerCommented:
hi apriigem,

this will work fine for u,

in flash
on (release) {
getURL("javascript:n_name=window.open('filename.htm','new_name1','width=325,height=229');void(0);");
}
 
in filename.htm

<a href="javascript:window.close();">Close Me</a>

make sure run this from a server (IIS or other), otherwise it will show a security warning.

hope this helps
kiranvj
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
apriigemAuthor Commented:
Ok, I tried that and when I tried to save the file I get an error message saying "A sharing violation has occured." Don't know what that means.
0
 
Kiran Paul VJComputer EngineerCommented:

its not related to the code above, i guess,
try saving the file to another location and try again.

kiranvj
0
 
Kiran Paul VJComputer EngineerCommented:
0
 
apriigemAuthor Commented:
ok, i fixed the sharing violation thing. the code i have to send the email works fine until I add the code from above to it. It causes the form to not work for some reason. I now get this error message

CDO.Message.1 error '8004020d'

At least one of the From or Sender fields is required, and neither was found.

/mailform.asp, line 23

Line 23 is where I have the email sent
"ObjMessage.Send"

See, I wasn't really trying to have a popup window open up, but it seems to be a by product of trying to send the email from flash through the asp page. I hope all this is making sense. I would love it if a window didnt pop up at all.
0
 
Kiran Paul VJComputer EngineerCommented:

it wont work because u are not submiting the form, u are just opening a window.

and for ur question its answered, how to popup a window from flash.

and if possible try to post the code. i will try to help but it will be nice if u post that as a new question.

kiranvj
0
 
apriigemAuthor Commented:
My question was how to CLOSE the pop up window using javascript and I am submitting the form. What I have right now is a form in Flash that when you click on the submit button, it sends the users information to an asp page that then sends it to an email address. That works fine, but once you hit submit, a window pops up(I assume it is the asp page). I would like it for this page to close right after it pops up, but currently it just stays there and I have this random blank window open. I was trying to find a way to close the window without any further interaction from the user. THe only code I have on the asp page right now is the code to send the email. You can visit touchcreations.com and then the contact page to see what happens.
0
 
apriigemAuthor Commented:
Thanks, but that link you posted only tells me to do what I have already done. I already have the url in the flash movie set to the asp page. I'll figure out. Thanks.
0
 
Kiran Paul VJComputer EngineerCommented:
hi apriigem,

thanks for the points,
i understood ur problem very well, that u dont want to change the current window and dont want to show a popup, i will try , if i find i will post here.

and i think there is a little problem in the flash in ur site, after showing the progress of loading completely its not loading the next frame, i have to right click the flash and click play to proceed.

kiranvj
0
 
Kiran Paul VJComputer EngineerCommented:

hi apriigem,
chk this page , its a free guest book made with flash and asp, here they are not opening a new windows to submit form,
check the flash file and get the logic and apply in your code
http://www.smartwebby.com/web_products/flash_guestbook/guestbook_interfaces.asp

download (from the above link)
http://www.smartwebby.com/web_products/flash_guestbook/downloads/MSAccessSmartGuestBook.zip

if none works try posting this in the flash section , u will get more help there.

kiranvj

0
 
Kiran Paul VJComputer EngineerCommented:
0
 
apriigemAuthor Commented:
Thanks, I didn't know that the site wasn't loading completely. It always loads automatically for me. I will try and fix that. Thanks for the links too. :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now