Go Back   AnandTech Forums > Software > Software for Windows

Forums
· Hardware and Technology
· CPUs and Overclocking
· Motherboards
· Video Cards and Graphics
· Memory and Storage
· Power Supplies
· Cases & Cooling
· SFF, Notebooks, Pre-Built/Barebones PCs
· Networking
· Peripherals
· General Hardware
· Highly Technical
· Computer Help
· Home Theater PCs
· Consumer Electronics
· Digital and Video Cameras
· Mobile Devices & Gadgets
· Audio/Video & Home Theater
· Software
· Software for Windows
· All Things Apple
· *nix Software
· Operating Systems
· Programming
· PC Gaming
· Console Gaming
· Distributed Computing
· Security
· Social
· Off Topic
· Politics and News
· Discussion Club
· Love and Relationships
· The Garage
· Health and Fitness
· Home and Garden
· Merchandise and Shopping
· For Sale/Trade
· Hot Deals with Free Stuff/Contests
· Black Friday 2014
· Forum Issues
· Technical Forum Issues
· Personal Forum Issues
· Suggestion Box
· Moderator Resources
· Moderator Discussions
   

Reply
 
Thread Tools
Old 06-02-2009, 02:46 PM   #1
fleabag
Banned
 
Join Date: Oct 2007
Posts: 2,451
Default How do you block specific java script from running?

I have a site I'm trying to use but it's a pain in the ass because it incorrectly detects (or lack thereof) that I don't have SVG viewer or a PDF viewer. Every page I load, after it gets to the bottom (where the script is located) it then automagically redirects me without even a pause time to stop it from doing it. I know where the script is located on the site and I was wondering if there was a way I could block THAT specific script AND or is there a program sort of like Noscript where it allows you to one at a time approve a java script command or deny it much like booting up in safemode I believe (you have to add a -command, but I hope you get the point).

I was also wondering if anyone was aware of a way to get downthemall to not specifically download the URL you give it, but to go to that url, wait for it to load and THEN download the re-directing url. I search google numerous times and while it seems to mention that this issue was solved in 1.0 (I have the latest version) its behavior seems to suggest otherwise. I don't believe I need to use "Anticontainer" because that seems to be for sites like imageshack where it loads a page which has elements on it and then it's suppose to "search" for the element, click on it and then save it...that's far more than what is needed. I think this site uses an XML redirecting scheme in order to allow you to download the files. (The files are PDFs)



Edit: I figured out how to do it. I found the offending script which is in a URL and I added the URL to that script to Ad Blocker Plus, effectively blocking the execution of the code. While it's great that I solved my problem, it still doesn't address the issue of knowing how to block a script that is written into the webpage and so I'm still interested in knowing how to use greasemonkey to accomplish this task.
fleabag is offline   Reply With Quote
Old 06-02-2009, 03:15 PM   #2
mechBgon
Super Moderator
Elite Member
 
mechBgon's Avatar
 
Join Date: Oct 1999
Posts: 30,699
Default How do you block specific java script from running?

In Internet Explorer, that would be possible using Internet Options > Security tab. You could modify the settings for the Internet zone so Scripting > Active Scripting is set to "Prompt." If it were me, I'd crank Trusted zone to Medium-High (like the Internet Zone), then modify Trusted's active-scripting setting and add the site to the Trusted zone, so you don't have to keep messing with the Internet Zone settings every time you want to use that site.
mechBgon is offline   Reply With Quote
Old 06-02-2009, 03:26 PM   #3
fleabag
Banned
 
Join Date: Oct 2007
Posts: 2,451
Default How do you block specific java script from running?

Quote:
Originally posted by: mechBgon
In Internet Explorer, that would be possible using Internet Options > Security tab. You could modify the settings for the Internet zone so Scripting > Active Scripting is set to "Prompt." If it were me, I'd crank Trusted zone to Medium-High (like the Internet Zone), then modify Trusted's active-scripting setting and add the site to the Trusted zone, so you don't have to keep messing with the Internet Zone settings every time you want to use that site.
Um, well I'm using Firefox and also while that idea seems sound, it turns out it doesn't work.. All it does is redirect to a blank page saying "restricted sites".. So much for that..
fleabag is offline   Reply With Quote
Old 06-02-2009, 04:35 PM   #4
superjohnyo
Senior Member
 
Join Date: May 2005
Posts: 257
Default How do you block specific java script from running?

you can try using greasemonkey and creating your own script - if you know the javascript function that is doing the redirect then you can just create the same function name in a script and just leave it blank.
superjohnyo is offline   Reply With Quote
Old 06-02-2009, 08:11 PM   #5
fleabag
Banned
 
Join Date: Oct 2007
Posts: 2,451
Default How do you block specific java script from running?

Quote:
Originally posted by: superjohnyo
you can try using greasemonkey and creating your own script - if you know the javascript function that is doing the redirect then you can just create the same function name in a script and just leave it blank.
I believe this is the script:
</script>


<script type="text/javascript" src="/t3Portal/staticcontent/js/t3StaticContentCommon.js"></script>



So how exactly would I block it with grease monkey?

I don't really understand how you would use greasemonkey to override scripts that are currently on the page. (I have it installed, just never have written for it and I have a limited time frame)

Tried to follow this:
http://www.dreamincode.net/forums/showtopic42646.htm

but with no luck. I'm totally unfamilar with javascript.
fleabag is offline   Reply With Quote
Old 06-02-2009, 09:40 PM   #6
superjohnyo
Senior Member
 
Join Date: May 2005
Posts: 257
Default How do you block specific java script from running?

OK my memory of greasemonkey was not correct. you actually have to place your function in the code for it to work correctly. here is the page that gives an example:
http://www.squakmt.com/replacing_javascript/index.htm
superjohnyo is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:13 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.