The init-crash-script Element"

From Documentation
Line 10: Line 10:
  
 
For example,
 
For example,
<source lang="xml" high="6" >
+
<source lang="xml" high="3, 6" >
 
<client-config>
 
<client-config>
 
<init-crash-script><![CDATA[
 
<init-crash-script><![CDATA[
    window.zkShowCrashMessage = function () {
+
    window.zkShowCrashMessage = function (code) {
 
    var h2 = '<h2 style="background: rgb(1,133,174); text-align: center; '  
 
    var h2 = '<h2 style="background: rgb(1,133,174); text-align: center; '  
 
    + 'color: white; width: 700px; margin: 0 auto;">';
 
    + 'color: white; width: 700px; margin: 0 auto;">';
    var msg = 'Ooooops!! zkErrorCode: ' + window.zkErrorCode;
+
    var msg = 'Ooooops!! ErrorCode: ' + code;
 
    h2 = h2 + msg + '</h2>';
 
    h2 = h2 + msg + '</h2>';
 
    document.body.style.background = 'rgb(1,133,174)';
 
    document.body.style.background = 'rgb(1,133,174)';
Line 24: Line 24:
 
</client-config>
 
</client-config>
 
</source>
 
</source>
* Line 6: User can get <code>window.zkErrorCode</code> for more manipulation.
+
* Line 2, 6: The error code will be passed as parameter, and then user can take it for further manipulation.
  
<code>window.zkErrorCode</code> has 5 values:
+
The error code has 5 values:
 
# zk before mounting error
 
# zk before mounting error
 
# zk mounting error
 
# zk mounting error

Revision as of 08:50, 14 November 2014


The init-crash-script Element


Syntax:

<init-crash-script>javascript function assigned to window.zkShowCrashMessage</init-crash-script>
[Default: see crashmsg.js]
[Since ZK 7.0.4]

It specifies how to customize crash message when initiation by writing a javascript function which is assigned to window.zkShowCrashMessage.

For example,

<client-config>
	<init-crash-script><![CDATA[
	    window.zkShowCrashMessage = function (code) {
	    	var h2 = '<h2 style="background: rgb(1,133,174); text-align: center; ' 
	    			+ 'color: white; width: 700px; margin: 0 auto;">';
		    var msg = 'Ooooops!! ErrorCode: ' + code;
		    h2 = h2 + msg + '</h2>';
		    document.body.style.background = 'rgb(1,133,174)';
		    document.body.innerHTML = h2;
	    }
	  ]]></init-crash-script>
</client-config>
  • Line 2, 6: The error code will be passed as parameter, and then user can take it for further manipulation.

The error code has 5 values:

  1. zk before mounting error
  2. zk mounting error
  3. zk after mounting error
  4. user script error
  5. server no response error

Version History

Last Update : 2014/11/14


Version Date Content
7.0.4 November, 2014 ZK-2495: When ZK init page, the loading animation runs in a endless loop


Last Update : 2014/11/14

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.