General Community > Scripting Help

Disabling View Source

(1/2) > >>

-=[Vyorel]=-:
Hello all!

Is there a script that will disable view source altogether?

Arantor:
No.

MrPhil:
You mean the HTML page source? No. It's not that valuable, anyway -- it would just be a static page. The real treasure is the data and the SMF PHP code. No one can get directly to your copies. What are you trying to hide?

Arantor:
Normally this gets asked alongside 'how can I block right click?' (answer, you can't) and 'how do I protect people copy/pasting text/images' (answer, you can't)

I've found, though, that this is a battle that isn't generally worth fighting over and normally leave it at 'it isn't possible' because it only leads to 'but it must be' followed by explaining the various provisions that make whatever you try to put in to 'protect yourself' easy to bypass...

-=[Vyorel]=-:
For disable right click is perfectly this mod, but I need to disable Ctrl+U.

For example this code:

--- Code: ---<script language="JavaScript">
function disableCtrlAltrKeyCombination(e)
{
    var ctrlu='u';
    var altrs='s';
    var key;
    var isCtrl;
    var isAltr;

    //For Ctrl
    //For Internet Explorer

    if(window.event)
    {
        key = window.event.keyCode;
        if(window.event.ctrlKey)
            isCtrl = true;
            else
        isCtrl = false;
    }
    //For Firefox
    else
    {
        key = e.which;     //firefox
        if(e.ctrlKey)
            isCtrl = true;
            else
        isCtrl = false;
    }

    //For Alter
    //For Internet Explorer
    if(window.event)
    {
        key = window.event.keyCode;     //IE
        if(window.event.altrKey)
            isAltr = true;
            else
        isAltr = false;
    }
    //For Firefox
    else
    {
        key = e.which;     //firefox
        if(e.altrKey)
            isAltr = true;
            else
        isAltr= false;
    }

    //Check For CTRL+U
    if(isCtrl)
    {
        if(ctrlu.toLowerCase() == String.fromCharCode(key).toLowerCase())
        {
            alert(‘Key combination CTRL + U has been disabled.’);
        }
        return false;
    }

    //Check For ALTR+S
    if(isCtrl)
    {
        if(altrs.toLowerCase() == String.fromCharCode(key).toLowerCase())
        {
            alert(‘Key combination ALTR + S has been disabled.’);
        }
        return false;
    }
    return true;
}
</script>

<input type="text" name="mytext" onKeyPress="return disableCtrlAltrKeyCombination(event);" onKeyDown="return disableCtrlAltrKeyCombination(event);" />
--- End code ---
but this code is not run.  :(

Navigation

[0] Message Index

[#] Next page

Go to full version