[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

How to autoclose a javascript after a certain time?

Hi

I am working on a webpage meant to display an alert after certain seconds. I have done this successfully but when I try to get it automatically disappear, every method fails.

B/W I must tell you that I cannot use <div> tags or new window popup in this particular scenario. I know those methods but dont need them in here.

Thanks in advance!
0
Wikkiboy
Asked:
Wikkiboy
1 Solution
 
dxdinhCommented:
it's impossible for you to do that - once you activate the alert (' your data here'); there is nothing running even your timer - so your best bet is to use modal dialog or "div" which consider a better practice ...

more on this with jQuery plug which provide a nice looking modal dialog box

http://jquery.malsup.com/block/

0
 
dxdinhCommented:
side note calling alert or confirm or prompt functions will freeze all script processing and focus - until the user response - those functions will freeze entire browser until user click
0
 
sjklein42Commented:
You will want to embellish, but this is a simple example of popping up a window for three seconds and then auto-closing it.
In this example the window is blank but you can set the first argument of window.open to a real URL.

<script>
popup = window.open("","mypopup","location=1,status=1,scrollbars=1,width=100,height=100");
setTimeout('popup.close()', 3000);
</script>
My Main Window

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
WikkiboyAuthor Commented:
Your Comment is certainly useful, but my problem is that I need to display a certain message while playing a video on iphone. Its iphone default behaviour that it runs video in its own player rather than browser. So modal dialogue only displays message on browser rather than on the video player. However alert displays above all solving my problem.

Please advise some other solution.
0
 
dxdinhCommented:
in that case - the only option is to inject your message to the streaming video ....
0
 
WikkiboyAuthor Commented:
But in case of iphone thats not possible, if that was possible we could have seen google ads while running youtube videos in iphone video player.

Please advise!
0
 
Michel PlungjanIT ExpertCommented:
But there are ads in youtube videos.

Since 2007 it seems

http://www.webtvwire.com/youtube-adverts-already-here/
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.

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