0

変数に基づくいくつかの関数を含むようにwebsenseブロックページを変更しています:$ * WS_BLOCKREASON*$。この変数の潜在産出量を知っているので、の特定の関数が必要です。

問題は、ページがデフォルトのケースでさえ'<'div'>'コンテンツに渡されないことです。基本的に、の内容は<div id="helpDiv">ボタンを含むテキストのセット全体である必要があります。以下のスクリプト:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Access to this site is blocked</title>
<link rel="stylesheet" href="/en/Custom/master.css" type="text/css">
<script type="text/javascript" language="javascript" src="/en/Default/master.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/base64.js"></script>
<script type="text/javascript" language="javascript" src="/en/Custom/security.js"></script>
<style type="text/css">
        .style1
        {
            width: 130px;
           height: 70px;
        }
    </style>
</head>
<body>

<!--[if lt IE 7]> <div style="width: 725px; height: 381px;"> <![endif] -->
        <img alt="BHI" class="style1" 
            src="/en/Custom/other.gif" /><br />
        <br />
        <br />
<div style="border: 1px solid #285EA6;width: 99.5%; max-width: 915px; overflow: hidden; margin-left: 1px; background-color: #EEF2F7;">
    <iframe src="$*WS_BLOCKMESSAGE_PAGE*$*WS_SESSIONID*$" title="BHI_BLOCK" 
        name="ws_block" frameborder="0" scrolling="no" 
        style="width:100%; height: 200px; margin-bottom: 0px;">
    </iframe>
<hr />
    <!-- onload=function() possible fix -->
    <script type="text/javascript">
    var blockReason=$*WS_BLOCKREASON*$;

    switch (blockReason)
        {
        case 'This Websense category is filtered: <b>Uncategorized</b>.':
            document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="button" VALUE="Submit UNCATEGORIZED website to Websense" onClick="parent.location=\'mailto:suggest@websense.com?subject=Uncategorized Website&body=Please review and correctly categorize the website that is listed below:%0A%0A' + $*WS_URL*$ + '%0A%0AThank you.\'"></p>\
            <hr />\
            <p style="margin-left: 64px">Clicking on the above button will open your mail client to send an e-mail to Websense for recategorization of the above site.</p>\
            <p style="margin-left: 64px">You will receive a confirmation e-mail and a case number from Websense indicating your request is proccessing.</p>\
            <p style="margin-left: 64px">Please note the response time for your request will vary. Allow to three to four (3-4) hours for updates to take effect once approved.</p>\
            <p style="margin-left: 64px">If you have any questions, please contact SOLV at <a href=tel:+18772222222>+1 877 2222222<a/> or <a href=http://solv:8093/CAisd/pdmweb.exe?OP=JUST_GRONK_IT+HTMPL=about.htmpl target="_blank">this link.</a></p>';
        break;

        case 'This Websense category is filtered: <b>Parked Domain</b>.':
            document.getElementById('helpDiv').innerHTML='<p>Parked domain</p>';
        break;

        default:
            document.getElementById('helpDiv').innerHTML='<p>No Block message help.</p>';
        }
    </script>
    <div frameborder="0" scrolling="no" style="width:100%; height: auto; margin-bottom: 0px;" id="helpDiv">
    </div>
<iframe src="$*WS_BLOCKOPTION_PAGE*$*WS_SESSIONID*$" name="ws_blockoption" 
        frameborder="0" scrolling="no" style="width:100%; height: auto;">
        <p>To enable further options, view this page with a browser that supports iframes</p>
    padding: 2px 0px;">
        <div style="clear: both; overflow: hidden; height:1px;"></div>
    </div>
</div>
<!--[if lt IE 7]> </div> <![endif]-->
<div id="light" class="white_content"></div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
4

2 に答える 2

0

この行で不適切にエスケープしました:

    document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="button" VALUE="Submit UNCATEGORIZED website to Websense" onClick="parent.location="'\\"mailto:suggest@websense.com?subject=Uncategorized Website&body=Please review and correctly categorize the website that is listed below:%0A%0A$*WS_URL*$%0A%0AThank you."'\\"></p>

それは(onClickの後)でなければなりません:

"parent.location=\'mailto:suggest@websense.com?subject=Uncategorized Website&body=Please review and correctly categorize the website that is listed below:%0A%0A' + $*WS_URL*$ + '%0A%0AThank you.\'"></p>\

エスケープを修正したフィドル: http://jsfiddle.net/3UxCc/ 動作します。

編集:変数がマーカー
のようです。$*WSこの場合blockReason、何かに割り当てていますが、WebSense 変数に引用符が含まれていない限り (そうではありません)、割り当ては次のようになります。

var blockReason = other;  

引用符で囲まれていotherないため、文字列リテラルではなく変数であると見なされます。これを次のように引用符で囲む必要があります。

var blockReason = '$*WS_BLOCKREASON*$';

これにより、スイッチが使用できる文字列リテラルとして確立されます。それ以外は、エラーをスローする悪い変数になります。

于 2012-10-26T20:03:03.497 に答える
0

代わりにこれを試してください。間違ったエスケープが行われています...

特にその部分は、ケースの最初の行の onClick の周りです

 case 'This Websense category is filtered: <b>Uncategorized</b>.':
    document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="button" VALUE="Submit UNCATEGORIZED website to Websense" onClick="parent.location=\'mailto:suggest@websense.com?subject=Uncategorized Website&body=Please review and correctly categorize the website that is listed below:%0A%0A' + $*WS_URL*$ + '%0A%0AThank you.\'"></p>\
    <hr />\
    <p style="margin-left: 64px">Clicking on the above button will open your mail client to send an e-mail to Websense for recategorization of the above site.</p>\
    <p style="margin-left: 64px">You will receive a confirmation e-mail and a case number from Websense indicating your request is proccessing.</p>\
    <p style="margin-left: 64px">Please note the response time for your request will vary. Allow to three to four (3-4) hours for updates to take effect once approved.</p>\
    <p style="margin-left: 64px">If you have any questions, please contact SOLV at <a href=tel:+18772097658>+1 877 209 7658<a/> or <a href=http://solv:8093/CAisd/pdmweb.exe?OP=JUST_GRONK_IT+HTMPL=about.htmpl target="_blank">this link.</a></p>';
break;

アップデート:

jsFiddle でプレイしたばかりなので、helpDiv への参照は無効であるという結論に達しました。

これらすべてをいくつかのアラートに置き換えると、スイッチはデフォルトに到達します。getElementById に何か問題があるため、死んでいます。エレメントに helpDiv という ID がないのではないでしょうか?

これは、よくて本当に簡素化されたバージョンです

http://jsfiddle.net/5wvC3/

ここに別のフィドルがあります-最後のものを更新して、コードがほとんど機能することを示します。HTMLに問題があることは間違いありません

http://jsfiddle.net/5wvC3/1/

于 2012-10-26T20:05:35.287 に答える