SetTimeout failure, regardless of the time set, is a direct jump

Source: Internet
Author: User

Recently, I encountered a problem that the JS function's timeout settings failed. For exampleCode

1 Protected   Void Page_load ( Object Sender, eventargs E)
2 {
3 If ( ! Ispostback)
4 {
5 String Target = Request. querystring [ " Target " ];
6 String Info = Request. querystring [ " Info " ];
7 If (Target ! =   Null   && Info ! =   Null )
8 {
9 Lbinfo. Text = Info;
10 Hlredirect. navigateurl = Target;
11 Clientscript. registerclientscriptblock ( This . GetType (), " Startup " ,
" <Script language = 'javascript '> setTimeout (window. Location. href =' "   + Target +   " ', 2000) </SCRIPT> " );
12 }
13 }
14 }

Originally, I was trying to log on to a forum. After a successful login, the system will display "Login successful, transfer to the forum page later ......" By receiving URL parameters to display the prompt content and the page to be transferred. HoweverProgramDuring the execution, there was no waiting at all, and it was transferred directly. No matter how many timeout numbers are set later, it is useless. I checked the relevant information and used single quotation marks for the timeout time. I have been very depressed. I don't know which big brother can give me some advice to see what went wrong.

By the way, will this project be related to Asp.net Ajax-enabled web site.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.