All nodes (Drupla 7) contain the following code:

<script type="text/javascript" src="http://localhost:8080/myfeodor.de/misc/jquery.js?v=1.4.4"></script>
<script type="text/javascript" src="http://localhost:8080/myfeodor.de/misc/jquery.once.js?v=1.2"></script>
<script type="text/javascript" src="http://localhost:8080/myfeodor.de/misc/drupal.js?nxe6cr"></script>
<script type="text/javascript" src="http://localhost:8080/myfeodor.de/sites/default/files/languages/de_HizaMms-3Ux-y0M1w9o2_EvSFCBziqwcKzQq9_kzJ78.js?nxe6cr"></script>
<script type="text/javascript">
    <!--//--><![CDATA[//><!--
    jQuery.extend(Drupal.settings, {
        "basePath": "\/myfeodor.de\/",
        "pathPrefix": "",
        "ajaxPageState": {
            "theme": "my_garland",
            "theme_token": "WTVBB9vMIjxgWuVheFjYXjuvpo1TgahCH62PRBBFGrA",
            "js": {
                "misc\/jquery.js": 1,
                "misc\/jquery.once.js": 1,
                "misc\/drupal.js": 1,
                "public:\/\/languages\/de_HizaMms-3Ux-y0M1w9o2_EvSFCBziqwcKzQq9_kzJ78.js": 1
            },
            "css": {
                "modules\/system\/system.base.css": 1,
                "modules\/system\/system.menus.css": 1,
                "modules\/system\/system.messages.css": 1,
                "modules\/system\/system.theme.css": 1,
                "modules\/comment\/comment.css": 1,
                "modules\/field\/theme\/field.css": 1,
                "modules\/node\/node.css": 1,
                "modules\/search\/search.css": 1,
                "modules\/user\/user.css": 1,
                "sites\/all\/themes\/my_garland\/style.css": 1,
                "sites\/all\/themes\/my_garland\/print.css": 1,
                "sites\/all\/themes\/my_garland\/fix-ie.css": 1
            }
        }
    });
    //--><!]]>
</script>

The file de_HizaMms-3Ux-y0M1w9o2_EvSFCBziqwcKzQq9_kzJ78.js
contains an associative array where error messages are translated.
But this appears not to be necessary since the page works also with
scripting deactivated in the browser.
This is WAMP, but under Linux the same code appears.

This code is also present if one is only reading without being logged in.
Is is possible to avoid this scripting?

Comments

nevets’s picture

Is it causing a problem?

BeginnersMind’s picture

It does not cause any programming problems. However, javascript implies inherent security risks for readers: see e.g. drive-by download malware attacks or Internet's Big Threat: Drive-by Attacks. Therefore, it would be very nice to be able to switch it off for people who dislike javascript and just want to read a post. (SPAM prevention timeout :-( ... nevermind..)

Jaypan’s picture

If you really want to do this (which I personally would never want to), you can implement hook_js_alter():

function HOOK_js_alter(&$javascript)
{
  $javascript = array();
}
BeginnersMind’s picture

I searched for it (not much knowing the PHP syntax).
hook_js_alter seems to be called by function drupal_get_js
which actually delegates this to function drupal_alter.

So obviously one would have to implement a new module.
If the scripting is needed in the backplane one perhaps
would also have to implement hook_user_login() and
hook_user_logout() (or other more suitable hooks) to check
whether an admin is logged in or not.

Seems to be somewhat out of reach for a non-web developer.

Jaypan’s picture

Yes, you would need to create a module. You wouldn't need to use hook_user_login() or hook_user_logout() though, you would do your checks within hook_js_alter() and if it was determined you wanted to remove the JS you would set $javascript = array().
But yes, maybe a little difficult for a non developer.

BeginnersMind’s picture

At drupal.stackexchange.com a simpler solution is presented. (Arggh... again catched by the captcha)

Jaypan’s picture

Simpler is a matter of opinion.

BeginnersMind’s picture

For an experienced Drupal developer it may be simpler to develop a new tiny module. This, in my opinion, is also more elegant and better from a software engineering viewpoint.

But for me and other users without profound knowledge of the Drupal codebase, it seems simpler to just copy a file into an already present custom theme and delete a line there. So it is only a workaround for non-experts which just run a very simple homepage like me.

So, as I can see, there is no actual difference in opinion about this. I only used the word "simple" with the meaning of "not so much work for an unexperienced user".