www.webdeveloper.com
Results 1 to 6 of 6

Thread: block some useless javascript code

  1. #1
    Join Date
    Jul 2012
    Posts
    3

    block some useless javascript code

    Hi everybody, im new here and new in java-coding .... I have a forum provided by some free host ... i dont have acces to "data-base" that include header. On my forum it's run some useless javascript codes ... so my answer is how i can block running/executing some of this code? If you dont under stand me i will explain more beter

    Excuse me, my english is weak !

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    This is usually prohibited by the host, although some time ago I was able to do it with a hexadecimal script that blocked their header...



    You would need to post an example.
    Another way you could do it is with a zero frame that scrapes your page and removes the script.

  3. #3
    Join Date
    Jul 2012
    Posts
    3
    For example, i will suppose that in my header is this java code (I can not change it beacause it's located in my header):
    Code:
    $(function(){$('a.mainmenu:contains("Inregistrare")').css("color","red");
    How i can block this?
    Or
    I have this JAVA-library that work on my forum : jquery-latest.jq hoq i can stop it ?
    OBs: I can not access my header!!!

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    Quote Originally Posted by scoalademate View Post
    For example, i will suppose that in my header is this java code (I can not change it beacause it's located in my header):
    Code:
    $(function(){$('a.mainmenu:contains("Inregistrare")').css("color","red");
    How i can block this?
    Or
    I have this JAVA-library that work on my forum : jquery-latest.jq hoq i can stop it ?
    OBs: I can not access my header!!!
    The only way that I can think of that will work is to run the page through a 'screen-scraper' and kill the code you don't want with PHP or some other server side programming language.

    You can also try to identify the code you don't like and comment it out...

    PHP Code:
    <!--
    //$offending code
    --> 
    In any event, it is far better to pay for hosting that lets you do what you like than to violate some free hosts TOS to hack their safeguards. If you get caught, than you will likely have your site removed for TOS violation, so better off to play fair.

  5. #5
    Join Date
    Jul 2012
    Posts
    3
    I have some librari like document.js with 42kb ... i want block it by using jquery ... it's posible ?

  6. #6
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    Yes, it is possible.

    Just use PHP to comment it out in the head, and/or replace it with a different library.

    If you are getting free hosting, and use this to block your free host from putting ads or frames on your page, this will probably only work for a short time as they will likely take down your site once they discover the script.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles