View Full Version : Disable execution of JS file

03-12-2007, 10:24 PM
Hello. I have a html file, that inside the html file I have only a document.write("<iframe src=http://....></iframe>");. This frame loads a lots of JS files. Is it possible to add some code to my html page to prevent viewing some of the JS files or disable it. I hope you can understand me. Thanks in advance

03-13-2007, 12:29 AM
There's been quite a few "can I disable JavaScript" questions lately, and the answer is no, you can't. The best you can do is use noscript tags.

03-13-2007, 01:16 AM
If you have some control over or connection to the page in the iframe, many things are possible. However, if it is on another domain and you have no access to that server, there isn't much that can be done. A server side script on your server may be able to serve the content of the page and then, you could do a lot with it before serving it through your iframe. This requires that your server is set up to do this and has nothing to do with javascript itself.

03-13-2007, 11:53 AM
This is the JS code:

var imgUrl,color,encode,tz,dst;
imgUrl = "http://www.ultrascores.com/ultrascores.gif";
tz = "&#37;2b0200";
document.write("<center><iframe src=http://free.7m.cn:10004/live_default.aspx?site=9533&Cr=" + color + "&encode=" + encode + "&img=" + imgUrl + " height=100% width=800></iframe></center>");

Basiclly this is my URL -

I want to remove left Menu, and top horizontal menu. I think that they are defined in a single .JS file. Is that possible? Or to get only the Livescore service which is in XML format? Thank you very much and excuse my English.

03-13-2007, 04:58 PM
The only way I can think of in that situation would be to use PHP or some other server side language to fetch the contents of the page to a local page. If that works, the external style and scripts from the page that are not coded with absolute URLs will stop working and the content as well as its remaining scripts and style could be massaged with either javascript or the server side language to format and present it as desired, including selective external scripts and/or stylesheets that were disabled (if any). However, this would likely be no simple task, if it could be done at all. I also suspect that it would be a violation of the terms of use of the remote resource. If that is the case, we aren't allowed to assist you further.

03-13-2007, 05:09 PM
Hello and thanks again for the reply jscheuer1. I don't think this will be violation of terms, because I have talked with their webmaster and he told me if I can use the info from the site that couldn't be problem or if I want to give them money to redesing it for me. But their fees are very high and that's why I search for solution here at master coders. Jscheuer1 I am not a programmer, but from your reply I understand allmost everything. Please can you tell me where to search the basics for this PHP script or tell me basiclly what I need to do and after that I will try do finish bymyself. Thank you again.

03-13-2007, 05:28 PM
Since what you are seeking is a way to obtain for free that which is generally offered for a fee, it is a violation of the site owner's copyright. Even if the owner invites you to try, that doesn't change that fact for me as, I've had no communication with them, so cannot know for sure what was meant by that.

It might be as simple as, "You can try it if you like but, you can't do it. We sell that service if you are really interested."

Anyways, I am off the hook as I really don't know enough about server side code to do more than get you started. The first step of many would be to determine if your server has PHP or some other server side language available to you and, if it does, if the permissions for it are such that would allow the importation of an external page to a local one.

As far as that first part goes, this thread:


on fetching a title from a remote page includes all that is required to fetch content via PHP if available and if the permissions on your server allow it.

If you can get that working with - say, Google being the the external page you are fetching, that will mean step one is possible.

As far as other server side languages like asp, jasp, etc., I have no clue how to even begin.

Finally, the likely complexity of getting this all to work, if it even can be done with this particular link, is way beyond the usual level of help rendered here in these forums. I for one don't have the time for it now and will not for at least a month or longer.