Find out where script is in source?

Ask for help about NoScript, no registration needed to post
Zenoxio

Find out where script is in source?

Post by Zenoxio » Thu Dec 24, 2009 8:19 pm

Let's say NoScript is blocking 3 scripts from 3 different domains on a page.

How can I find out what line in the source NoScript is blocking? For example, it is telling me it is blocking a script from atdmt.com but I can't find that anywhere in the page source.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

User avatar
therube
Ambassador
Posts: 7519
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Find out where script is in source?

Post by therube » Thu Dec 24, 2009 9:25 pm

JSView

"All browsers include a "View Source" option, but none of them offer the ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page's..."
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7pre) Gecko/20091211 SeaMonkey/2.0.2pre

User avatar
computerfreaker
Senior Member
Posts: 220
Joined: Wed Sep 16, 2009 10:03 pm
Location: USA

Re: Find out where script is in source?

Post by computerfreaker » Fri Dec 25, 2009 2:48 am

therube wrote:JSView

"All browsers include a "View Source" option, but none of them offer the ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page's..."

I'm a user of JSView, so I might as well share its one huge limitation: it doesn't show all scripts on a webpage.
Just an example: NoScripts says it blocked, say, 34 scripts but JSView only picks up, say, 10 of those. That's a pretty frequent occurrence...
With great power comes great responsibility.
Learn something new every day, and the rest will take care of itself.
Life is a journey, not a destination. Enjoy the trip!
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

Alan Baxter
Ambassador
Posts: 1586
Joined: Fri Mar 20, 2009 4:47 am
Location: Colorado, USA

Re: Find out where script is in source?

Post by Alan Baxter » Fri Dec 25, 2009 2:58 am

computerfreaker wrote:I'm a user of JSView, so I might as well share its one huge limitation: it doesn't show all scripts on a webpage.
Just an example: NoScripts says it blocked, say, 34 scripts but JSView only picks up, say, 10 of those. That's a pretty frequent occurrence...

In my experience, JSView picks up all the externally sourced scripts. It's not intended to list the scripts that are sourced in the main page itself. NoScript reports those too. If you have a link to a page where that isn't the case, could you provide it? I'd like to see it. I could be wrong, and if so I'd like to see just where.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

User avatar
computerfreaker
Senior Member
Posts: 220
Joined: Wed Sep 16, 2009 10:03 pm
Location: USA

Re: Find out where script is in source?

Post by computerfreaker » Fri Dec 25, 2009 3:28 am

computerfreaker wrote:I'm a user of JSView, so I might as well share its one huge limitation: it doesn't show all scripts on a webpage.
Just an example: NoScripts says it blocked, say, 34 scripts but JSView only picks up, say, 10 of those. That's a pretty frequent occurrence...

Alan Baxter wrote:In my experience, JSView picks up all the externally sourced scripts. It's not intended to list the scripts that are sourced in the main page itself. NoScript reports those too. If you have a link to a page where that isn't the case, could you provide it? I'd like to see it. I could be wrong, and if so I'd like to see just where.

So that's the difference in script count. I had never noticed a defining factor... then again, I haven't had time lately to look for one.
With great power comes great responsibility.
Learn something new every day, and the rest will take care of itself.
Life is a journey, not a destination. Enjoy the trip!
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: Find out where script is in source?

Post by Tom T. » Fri Dec 25, 2009 5:58 am

Alan Baxter wrote:
computerfreaker wrote:I'm a user of JSView, so I might as well share its one huge limitation: it doesn't show all scripts on a webpage.
Just an example: NoScripts says it blocked, say, 34 scripts but JSView only picks up, say, 10 of those. That's a pretty frequent occurrence...

In my experience, JSView picks up all the externally sourced scripts. It's not intended to list the scripts that are sourced in the main page itself. NoScript reports those too. If you have a link to a page where that isn't the case, could you provide it? I'd like to see it. I could be wrong, and if so I'd like to see just where.

I recently added JS View, and was very disappointed. The name suggests that you can view *all* scripts on, or trying to load on, the page. The promo says,

All browsers include a "View Source" option, but none of them offer the ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page's source code. Previously if you wanted to view the source code of an external javascript/stylesheet you would have to manually look through the source code to find the url and then type that into your browser.rnrnWell now there's a much easier way. You can use the JSView extension to solve the problem. You can access it from the context menu, from the toolbar, from the view menu, or from the status bar. If the website you are viewing contains any external js/css files, an icon will appear that says "SS", "JS", or both. Each individual file can then be viewed by clicking on the filename. The file will be opened in a new window. You can also choose to open all external files by clicking on "View All".rnrn With the latest version you can now view the embedded css and js as well (FF2 and SM2 only)
(emphasis is mine).

But right now, I have 83 scripts running at Yahoo mail, and only seven are readable by JS View. I thought the emphasized sentence meant that I could view the Yahoo scripts native to the page. (It's possible that FF2 was a typo for F3, since SM2 = F3 gecko.)

And apparently, whatever "most" sites do, Yahoo doesn't "store their js externally", or at least, not in a place where JS View can read them, which is what I was hoping for. 76 scripts that it can't read and display for me.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20

Alan Baxter
Ambassador
Posts: 1586
Joined: Fri Mar 20, 2009 4:47 am
Location: Colorado, USA

Re: Find out where script is in source?

Post by Alan Baxter » Fri Dec 25, 2009 6:35 am

Tom T. wrote:The promo says,
All browsers include a "View Source" option, but none of them offer the ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page's source code. Previously if you wanted to view the source code of an external javascript/stylesheet you would have to manually look through the source code to find the url and then type that into your browser.rnrnWell now there's a much easier way. You can use the JSView extension to solve the problem. You can access it from the context menu, from the toolbar, from the view menu, or from the status bar. If the website you are viewing contains any external js/css files, an icon will appear that says "SS", "JS", or both. Each individual file can then be viewed by clicking on the filename. The file will be opened in a new window. You can also choose to open all external files by clicking on "View All".rnrn With the latest version you can now view the embedded css and js as well (FF2 and SM2 only)
(emphasis is mine).

But right now, I have 83 scripts running at Yahoo mail, and only seven are readable by JS View. I thought the emphasized sentence meant that I could view the Yahoo scripts native to the page. (It's possible that FF2 was a typo for F3, since SM2 = F3 gecko.)

No typo[1]. Read what immediately follows your quote on https://addons.mozilla.org/en-US/firefox/addon/2076
Just open the "Page Info" window from the context menu or tools menu. There will be 3 new tabs in that window. One for scripts, one for stylesheets, and one for frames.

It works in Fx 2.0.0.20. Click on the Scripts tab in the Page Info window. The embedded scripts will be listed;. Each of them can be viewed by double-clicking on it. Ron never got around to making this feature work in Fx 3. He said it was on his todo list, but he effectively abandoned the project last January. I miss that feature, but it's only a minor inconvenience. All the embedded scripts can be viewed directly with View Source.

[1] I think "SM2" may have been a typo, but I haven't tested it. Ron may have meant one of the later versions of SM1.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: Find out where script is in source?

Post by Tom T. » Fri Dec 25, 2009 7:52 am

Alan Baxter wrote:<snip>
No typo[1]. Read what immediately follows your quote on https://addons.mozilla.org/en-US/firefox/addon/2076
Just open the "Page Info" window from the context menu or tools menu. There will be 3 new tabs in that window. One for scripts, one for stylesheets, and one for frames.

It works in Fx 2.0.0.20. Click on the Scripts tab in the Page Info window. The embedded scripts will be listed;. Each of them can be viewed by double-clicking on it. Ron never got around to making this feature work in Fx 3. He said it was on his todo list, but he effectively abandoned the project last January. I miss that feature, but it's only a minor inconvenience. All the embedded scripts can be viewed directly with View Source.

[1] I think "SM2" may have been a typo, but I haven't tested it. Ron may have meant one of the later versions of SM1.

I did see that. I can't find anything called a Page Info window, nor anything with a Scripts tab. Just click the icon and get a menu like NS's, with some JS and some SS. R-clicking the icon includes a choice called Object Reference, but there is no Scripts tab, mostly frame references.

So, where is this window, and how does one get there, starting from either Fx Tools > Addons, or, preferably, from the taskbar icon? :?:

All the embedded scripts can be viewed directly with View Source.

I guess I expected the tool to show one embedded script at a time, for easier reading on a page with 76 embedded scripts. Perhaps my expectations were too high. TIA.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20

Alan Baxter
Ambassador
Posts: 1586
Joined: Fri Mar 20, 2009 4:47 am
Location: Colorado, USA

Re: Find out where script is in source?

Post by Alan Baxter » Fri Dec 25, 2009 3:17 pm

You're welcome. Merry Christmas, Tom. :D

Tom T. wrote:So, where is this window, and how does one get there, starting from either Fx Tools > Addons, or, preferably, from the taskbar icon? :?:

Sorry, I should have been more specific. Tools->Page Info

I don't use JSView that often and the Object Reference isn't useful to me, so I removed it from the status bar and the context menu. It's easy enough to access from the View menu. A right-click on any the scripts or style sheets listed there will give you various choices for viewing the scripts, but so does right-clicking in the Scripts panel.
Alan Baxter wrote:I think "SM2" may have been a typo, but I haven't tested it. Ron may have meant one of the later versions of SM1.

I tested this in SM 2.0.1 too. The addition of Scripts, Style Sheets, and Frames panels to the Page Info isn't present in either SM 2.0.1 or Fx 3.0 or newer. It must be available only to Gecko 1.8.x users.

I guess I expected the tool to show one embedded script at a time, for easier reading on a page with 76 embedded scripts.

76 scripts! Yikes! Most of them may be pretty short. I don't have Yahoo mail anymore, so I can't check that out myself. Hm, NoScript says my wunderground.com page has 73 scripts. I wonder if JSView will list them all in the Tools > Page Info > Scripts panel in Fx 2. ... Lots of entries there, but it doesn't look like 73. Maybe JSView doesn't count them the same way NoScript does.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

User avatar
therube
Ambassador
Posts: 7519
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Find out where script is in source?

Post by therube » Fri Dec 25, 2009 5:29 pm

since SM2 = F3 gecko

SM2 = FF3.5 gecko

With the latest version you can now view the embedded css and js as well (FF2 and SM2 only). Just open the "Page Info" window from the context menu or tools menu. There will be 3 new tabs in that window. One for scripts, one for stylesheets, and one for frames.


Image
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7pre) Gecko/20091211 SeaMonkey/2.0.2pre

User avatar
therube
Ambassador
Posts: 7519
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Find out where script is in source?

Post by therube » Fri Dec 25, 2009 5:39 pm

On Yahoo (mail), NoScript shows 77 scripts forbidden. Page Info shows 77 scripts (& yes, I did count them).
Now while it enumerates the inline scripts, there isn't really anything you can do with them (from within JSView in SeaMonkey).

76 scripts that it can't read and display for me

Though you can open the source & search for "<script " ...

It works in Fx 2.0.0.20. Click on the Scripts tab in the Page Info window. The embedded scripts will be listed;. Each of them can be viewed by double-clicking on it.


That part, the double-clicking is not working in SM2. Does work in FF2.


Image

Image
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7pre) Gecko/20091211 SeaMonkey/2.0.2pre

User avatar
therube
Ambassador
Posts: 7519
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Find out where script is in source?

Post by therube » Fri Dec 25, 2009 6:08 pm

Style Sheets not in SM2.

Image

Links tab in FF2 does not show scripts.

Image

JSView adds Scripts, Style Sheets, & Frames into FF2.

Image

This all works the same (as in FF2) in SeaMonkey 1.1.18 (Gecko 1.8.1).
SeaMonkey 2 mostly works (Scripts are shown in the Links panel, but Style Sheets & Frames are not shown).
External script/css works as expected.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7pre) Gecko/20091211 SeaMonkey/2.0.2pre

Alan Baxter
Ambassador
Posts: 1586
Joined: Fri Mar 20, 2009 4:47 am
Location: Colorado, USA

Re: Find out where script is in source?

Post by Alan Baxter » Fri Dec 25, 2009 6:13 pm

The scripts are listed in the Links panel in SM 2.0.1 even if JSView isn't installed. The Page Info features added by JSView don't work at all in SM 2.

Edit: Did someone get a screengrabber for Christmas?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

User avatar
therube
Ambassador
Posts: 7519
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Find out where script is in source?

Post by therube » Fri Dec 25, 2009 6:22 pm

The scripts are listed in the Links panel in SM 2.0.1 even if JSView isn't installed.

I did not check to see if that was the case.

The Page Info features added by JSView don't work at all in SM 2.

:( .

Did someone get a screengrabber

heh.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7pre) Gecko/20091211 SeaMonkey/2.0.2pre

Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: Find out where script is in source?

Post by Tom T. » Sat Dec 26, 2009 12:22 am

Alan Baxter wrote:Sorry, I should have been more specific. Tools->Page Info

Ahhhhh! :idea: I was going through either Add-ons > Options or, mostly, from the taskbar icon itself (which is where, uh, I usually access a tool - you know, like, uh, what's it's name? Oh, yeah, "NoScript". d'oh, me! :? )
Would never have thought to look in the Tools > Page Info; just figured JS View was self-contained.

Alan Baxter wrote:I think "SM2" may have been a typo, but I haven't tested it. Ron may have meant one of the later versions of SM1......
I tested this in SM 2.0.1 too. The addition of Scripts, Style Sheets, and Frames panels to the Page Info isn't present in either SM 2.0.1 or Fx 3.0 or newer. It must be available only to Gecko 1.8.x users.

Sad, because it would really be useful in F3+. Maybe someone else will adopt it. (And you guys keep wondering why I stick with F2.20 much of the time! :mrgreen: ;) )

I guess I expected the tool to show one embedded script at a time, for easier reading on a page with 76 embedded scripts.

Alan Baxter wrote:76 scripts! Yikes! Most of them may be pretty short. I don't have Yahoo mail anymore, so I can't check that out myself. Hm, NoScript says my wunderground.com page has 73 scripts. I wonder if JSView will list them all in the Tools > Page Info > Scripts panel in Fx 2. ... Lots of entries there, but it doesn't look like 73. Maybe JSView doesn't count them the same way NoScript does.

Yep, JSV *does* show all embedded scripts through the path you gave, and 2-clicking any one *does* open just that one, exactly as I had hoped!

And yes, some are as small as 30 bytes, e. g.:

Code: Select all

gLaunchProfile.start('FIT');


The largest, for "compose" (new message) is 15.4 Kb. (and for some reason, is there twice :?: )
Clearly, these were added in, feature-by-feature or per-need, rather than grouping similar functions into one larger one.
Alan Baxter wrote:You're welcome. Merry Christmas, Tom. :D

Thanks, Alan. Merry Christmas to you, too! :D
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20

Post Reply