Implementation of smartnavigation in. NET Framework 2.0

Source: Internet
Author: User

The implementation of smartnavigation in. NET Framework 2.0 is the same as that in 1.1, but there are three changes:
The first is to add a state parameter "_ smartnavpostback", which is implemented by a hidden domain. When attachform is added to IFRAME _ smartnav, It is dynamically inserted into the from. The status of window. _ smartnav. init is set to true (the default value is false), but this status is not used throughout the smart navigate process. This may be for otherCodeThe Usage Status tells others that the page has been controlled by smart navigation.
The second is to update CSS updates. How can this problem be avoided? This is because if the CSS file is dynamically updated, smart navigate should also ensure that it can be updated to our actual document, this is ignored by M $ in the implementation of 1.1. The code is:

VaR SS = Document. stylesheets;
For (VAR I =   0 ; I < SS. length; I ++ ) {
Ss [I]. href=Ss [I]. href;
}

The principle is the same as that of document. Location = Document. location.
The third is bug fixing. The jscript update method in 1.1 is the same as the CSS update method. The code is:

VaR SC = Document. scripts;
For (VAR I =   0 ; I < SC. length; I ++ )
{
SC [I]. Text=SC [I]. text;
}

This method was changed in 2.0, and CSS was updated using this method. Why? I think the script has a higher priority, because if the page is dependent on the script and the script cannot be updated, nothing can be done on the page, and CSS cannot be updated without guarantee, at most, the display appearance is a problem. Therefore, in 2.0, M $ specifically implemented a function window. _ smartnav. loadscript to update the script. The code is:

Window. _ smartnav. loadscript = Function () {
VaR allscriptloaded =   True ;
VaR SC = Document. scripts;
For (VAR I =   0 ; I < SC. length; I ++ ) {
If (SC [I]. SRC ! =   Null   && SC [I]. SRC. Length >   0 ) {
If (SC [I]. readystate ! =   ' Loaded '   && SC [I]. readystate ! =   ' Complete '   && SC [I]. readystate ! =   ' Interactive ' ) {
Allscriptloaded= False;
}
}
}
If (Allscriptloaded) {
For (VAR I =   0 ; I < SC. length; I ++ ) {
SC [I]. Text=SC [I]. text;
}
If ( Typeof (Window. onload) =   " String " )
{
Try   {Eval (window. onload )}   Catch (E) {} ;
}
Else   If (Window. onload ! =   Null )
{
Try   {Window. onload ()}   Catch (E) {} ;
}
}
Else   {
SetTimeout ('Window. _ smartnav. loadscript ();',100);
}
} ;

This function is self-triggered. If the script cannot be loaded with loaded, complete, or interactive, it will try again and again at a frequency of 10Hz.

I thought that the smartnavigation of Framework 2.0 could surprise people, because recently it was stimulated by Gmail webmail, and the results were a little disappointing.

 

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.