The init-crash-script Element"

From Documentation
(Created page with "{{ZKConfigurationReferencePageHeader}} '''Syntax:''' <init-crash-script>javascript function assigned to '''window.zkShowCrashMessage'''</init-crash-script> [Default: see cras...")
 
 
(7 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
  [Default: see crashmsg.js]
 
  [Default: see crashmsg.js]
[Since ZK 7.0.4]
 
  
It specifies how to customize crash message when initiation by write a javascript function which is assigned to <code>window.zkShowCrashMessage</code>
+
{{versionSince| 7.0.4}}
 +
 
 +
If the client engine stops working before even the error handling is initialized (e.g. when ZK's core scripts fail to download - <code>zk.wpd</code>), you will see the message below:
 +
 
 +
[[File:error_handling_crash_screen.png| center]]
 +
 
 +
This element allows you to show a custom crash message when initiation by writing a javascript function which is assigned to <code>window.zkShowCrashMessage</code>.
 +
 
 
For example,
 
For example,
<source lang="xml" high="6" >
+
<source lang="xml" highlight="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 23: Line 29:
 
</client-config>
 
</client-config>
 
</source>
 
</source>
* Line 6: User can get <code>window.zkErrorCode</code> for more manipulation.
+
* Line 3, 6: The error code will be passed as a parameter, and you can take it for further use.
 +
 
 +
= Error Code =
 +
The error code has 5 values:
 +
# zk before mounting error
 +
#: ZK client fails to proceed before mounting ZK javascript widgets.
 +
# zk mounting error
 +
#: ZK client fails during mounting ZK javascript widgets
 +
# zk after mounting error
 +
#: ZK client fails after mounting ZK javascript widgets.
 +
# user script error
 +
#: ZK client fails while running your custom javascript code
 +
# server no response error
  
 
=Version History=
 
=Version History=

Latest revision as of 04:03, 19 December 2023


The init-crash-script Element


Syntax:

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

Since 7.0.4

If the client engine stops working before even the error handling is initialized (e.g. when ZK's core scripts fail to download - zk.wpd), you will see the message below:

Error handling crash screen.png

This element allows you to show a custom 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 3, 6: The error code will be passed as a parameter, and you can take it for further use.

Error Code

The error code has 5 values:

  1. zk before mounting error
    ZK client fails to proceed before mounting ZK javascript widgets.
  2. zk mounting error
    ZK client fails during mounting ZK javascript widgets
  3. zk after mounting error
    ZK client fails after mounting ZK javascript widgets.
  4. user script error
    ZK client fails while running your custom javascript code
  5. server no response error

Version History

Last Update : 2023/12/19


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


Last Update : 2023/12/19

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