In some cases, the page loading business pass JS code failed, resulting in the visitor click the Advisory button can not enter the Business Access dialog window, the following medical template library for everyone to organize a piece of code, you can prevent the business through the load failure caused the visitors cannot open the dialog window this situation occurs.
The complete code is as follows:
<script type= "Text/javascript" >
function Online () {
var e = ' Anniu ';
if (arguments.length = = 1) {
E = encodeURIComponent (arguments[0]);
}
if (typeof Openzoosurl = = "undefined") {
Test please replace this address with your own business address
var url = ' http://test.zoossoft.net/LR/Chatpre.aspx?id=test001&lng=cn&rf1= ' + encodeuricomponent ( Document.referrer);
url = url + ' &e= ' + E + ' &p= ' + encodeuricomponent (location.href);
try{
window.open (URL, ' News ' + (new Date ()). GetTime ());
}catch (e) {
location.href = URL;
}
}else{
Openzoosurl (' Chatwin ', ' &e= ' + e);
}
return false;
}
</script>
Code Usage Instructions:
1, the actual test use, please replace the business address in the code with their own http://test.zoossoft.net/LR/Chatpre.aspx?id=test001
2. Before we add the Open Business Pass Dialog window button on the website, it is generally added as follows:
<a href= "/swt/" > Consulting online expert </a>//How to use page jump
<a href= "javascript:;"//Use the business pass to bring up the dialog window function, the same as below.
<a href= "Javascript:openzoosurl (' Chatwin ', ' &e=zhuanjia ')" > Consulting online expert </a>
If you use the above to provide a fault tolerant code, you only need to modify the connection code to the following:
<a href= "javascript:;" onclick= "Online (' Zhuanjia ')" > consulting on-line expert </a><a href= "Javascript:online (' Zhuanjia ') > Consulting online Experts </a>
Code principle:
The code just makes a judgment, judge whether the Openzoosurl function is defined, Openzoosurl is the function of opening the dialog window with the business pass, if it has been defined that the business pass code is loaded correctly, then we call the business Access function to open the dialog box. If the function is undefined, then the business pass code loading fails, we use the Business Access Dialog window link to open the dialog window, where the above provided code contains the URL to get the address of the route, the current page address of the code, passed to the business to the background, to prevent the loss of track.
Business Pass open conversation window fault tolerant code