473,473 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Contents of a <script> element

I would like to, for debugging purposes, obtain the contents of a
<script> element. I'm aware that the text property contains the text
contained within the element. However, the <script> element I'm
interested is an external script, specified with the src attribute.
Is there a way to access the linked contents of such an element?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 3 '05 #1
2 1402
Christopher Benson-Manica wrote:
I would like to, for debugging purposes, obtain the contents of a
<script> element. I'm aware that the text property contains the text
contained within the element. However, the <script> element I'm
interested is an external script, specified with the src attribute.
Is there a way to access the linked contents of such an element?


View the page source, build a URL from the src attribute of the script
element and past it into your browser's address bar.

Many browsers will download the script file (along with all the other
page content) if you use 'Save as'.

--
Rob
Nov 3 '05 #2
RobG wrote on 03 nov 2005 in comp.lang.javascript:
Christopher Benson-Manica wrote:
I would like to, for debugging purposes, obtain the contents of a
<script> element. I'm aware that the text property contains the text
contained within the element. However, the <script> element I'm
interested is an external script, specified with the src attribute.
Is there a way to access the linked contents of such an element?


View the page source, build a URL from the src attribute of the script
element and past it into your browser's address bar.

Many browsers will download the script file (along with all the other
page content) if you use 'Save as'.


If it is not a frames-page, paste this as one line in your address bar:

javascript:t='';g=function(d){x=d.styleSheets;for( i=0;i<x.length;i++){m
('link',x[i].href);y=x[i].imports;for(j=0;(y&&j<y.length);j++)m('@import',y
[j].href)}z=d.getElementsByTagName('script');for(k=0; k<z.length;k++)m
('script',z[k].src)};m=function(n,s){if(s){if(a){a=0;t+='<br>fra me<br>'}
t+='['+n+']\t<a\thref='+s+'>'+s+'</a><br>'}};a=0;g(document);f=frames;for
(h=0;h<f.length;h++){a=1;try{g(f[h].document)}catch(e){}}with(open
('','','width=620,height=140,scrollbars,resizable' ).document){write
(t);close()}

[or make a favelet/bookmarklet of it.]
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 3 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
1
by: Albert Wagner | last post by:
Opera 7 doesn't appear to support the <script> element in XHTML. Does this mean that it impossible to use Javascript with XHTML? Or is there a workaround, such as the legacy method, in HTML, of...
0
by: Tony Hedge | last post by:
Hello, I'm using .NET 1.0 on W2K. In my web app solution I have the following hierarchy: -MyWeb.proj ---\Images ---\Styles ---\US -----Main.aspx -----\Images
9
by: sam.s.kong | last post by:
Hello! I have a JavaScript code like the following. <script> var s = "</script>"; ....
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
12
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript">...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
2
by: boczek | last post by:
Hello all. I'm writing a small async webapp. in JavaScript and I'm using <script> element technique to load data. I'm usign <scriptbecause of cross domain restrictions with XmlRequest. The...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.