Hi,
I want to write a script that (run from a file on the local HD) reads
another local html-file into a variable, then make some changes to it, and
then output the result in a way that makes it simple for the user to save
it again. And all of this should run in any current browser, not just IE.
I managed to access the code of the current document by
code = document.docume ntElement.inner HTML
But when I open another window with the file I want to edit, all I get is
<head></head><body></body>
For the output I tried to do document.write in an output window, but I
can't save the code I generate there, all I get is the sourcecode of my
script page (the opener of the page I try to save). Any hints?
Oh, just in case that matters, I'm using Galeon on Linux.
I hope someone out there can help me.
Thanks, Christian 7 18553
Christian Schmitt hu kiteb: For the output I tried to do document.write in an output window, but I can't save the code I generate there, all I get is the sourcecode of my script page (the opener of the page I try to save). Any hints?
Yep. Use a programing language in an environment that actuially has
permission to write a file. This does not apply to javascript running in
teh context of a web browser.
--
--
Fabian
Visit my website often and for long periods! http://www.lajzar.co.uk
Christian Schmitt wrote: I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it simple for the user to save it again. And all of this should run in any current browser, not just IE.
I managed to access the code of the current document by code = document.docume ntElement.inner HTML
But when I open another window with the file I want to edit, all I get is <head></head><body></body>
For the output I tried to do document.write in an output window, but I can't save the code I generate there, all I get is the sourcecode of my script page (the opener of the page I try to save). Any hints?
Oh, just in case that matters, I'm using Galeon on Linux.
This sounds all like a task for server side scripting with PHP or JSP or
ASP.
But I think Galeon is Mozilla based so maybe it offers
XMLHttpRequest
e.g.
if (typeof XMLHttpRequest != 'undefined') {
var httpRequest = new XMLHttpRequest( );
httpRequest.ope n('GET', 'whatever.html' , false);
httpRequest.sen d(null);
alert(httpReque st.responseText );
}
That way you can read text pages from the same server the page with the
script is loaded from.
--
Martin Honnen http://JavaScript.FAQTs.com/
On Fri, 21 Nov 2003, Fabian wrote: Christian Schmitt hu kiteb:
For the output I tried to do document.write in an output window, but I can't save the code I generate there, all I get is the sourcecode of my script page (the opener of the page I try to save). Any hints?
Yep. Use a programing language in an environment that actuially has permission to write a file. This does not apply to javascript running in teh context of a web browser.
Well, for several reasons I'm limited to Javascript. And I don't want to
initiate the saving from the script, just create a document that the user
can save manually.
PL
On Fri, 21 Nov 2003, Martin Honnen wrote:
Christian Schmitt wrote: I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it simple for the user to save it again. And all of this should run in any current browser, not just IE.
I managed to access the code of the current document by code = document.docume ntElement.inner HTML
But when I open another window with the file I want to edit, all I get is <head></head><body></body>
For the output I tried to do document.write in an output window, but I can't save the code I generate there, all I get is the sourcecode of my script page (the opener of the page I try to save). Any hints?
Oh, just in case that matters, I'm using Galeon on Linux. This sounds all like a task for server side scripting with PHP or JSP or ASP.
This all takes place locally, the script is not on a server.
But I think Galeon is Mozilla based so maybe it offers XMLHttpRequest e.g. if (typeof XMLHttpRequest != 'undefined') { var httpRequest = new XMLHttpRequest( ); httpRequest.ope n('GET', 'whatever.html' , false); httpRequest.sen d(null); alert(httpReque st.responseText ); } That way you can read text pages from the same server the page with the script is loaded from.
XMLHttpRequest seems to be supported, but hangs the browser :-((
Perhaps because I try to read a local file?
Any other ideas?
PL
Christian Schmitt wrote: On Fri, 21 Nov 2003, Martin Honnen wrote:Christian Schmitt wrote:
I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it simple for the user to save it again. And all of this should run in any current browser, not just IE.
I managed to access the code of the current document by code = document.docume ntElement.inner HTML
But when I open another window with the file I want to edit, all I get is <head></head><body></body>
For the output I tried to do document.write in an output window, but I can't save the code I generate there, all I get is the sourcecode of my script page (the opener of the page I try to save). Any hints?
Oh, just in case that matters, I'm using Galeon on Linux.
This sounds all like a task for server side scripting with PHP or JSP or ASP.
This all takes place locally, the script is not on a server.
I understand that you are attempting things locally, but it sounds more
like a task to be solved with PHP or ASP or JSP as there you don't run
into the restrictions client side JavaScript has to access the file
system or any Web server. But I think Galeon is Mozilla based so maybe it offers XMLHttpRequest e.g. if (typeof XMLHttpRequest != 'undefined') { var httpRequest = new XMLHttpRequest( ); httpRequest.ope n('GET', 'whatever.html' , false); httpRequest.sen d(null); alert(httpReque st.responseText ); } That way you can read text pages from the same server the page with the script is loaded from.
XMLHttpRequest seems to be supported, but hangs the browser :-(( Perhaps because I try to read a local file?
The third argument to the open() call is the asynchronous mode, in the
example above that is false meaning the send() call later will block the
beowser till the file is loaded.
You can also perform asynchronous requests, then you need to set up an
httpRequest.onr eadystate
handler.
If you do not even want to read files via http but only from the local
file system then perhaps XPConnect can do that with Galeon http://www.faqts.com/knowledge_base/...d/23360/fid/53
--
Martin Honnen http://JavaScript.FAQTs.com/
On Fri, 21 Nov 2003, Martin Honnen wrote: But I think Galeon is Mozilla based so maybe it offers XMLHttpRequest e.g. if (typeof XMLHttpRequest != 'undefined') { var httpRequest = new XMLHttpRequest( ); httpRequest.ope n('GET', 'whatever.html' , false); httpRequest.sen d(null); alert(httpReque st.responseText ); } That way you can read text pages from the same server the page with the script is loaded from.
XMLHttpRequest seems to be supported, but hangs the browser :-(( Perhaps because I try to read a local file?
The third argument to the open() call is the asynchronous mode, in the example above that is false meaning the send() call later will block the beowser till the file is loaded.
That much I found out already, but why doesn't it load at all? Loading a
small local file should happen instantly.
You can also perform asynchronous requests, then you need to set up an httpRequest.onr eadystate handler.
If you do not even want to read files via http but only from the local file system then perhaps XPConnect can do that with Galeon http://www.faqts.com/knowledge_base/...d/23360/fid/53
But this works only in Mozilla-based browsers, right? I need something
that works in ALL (well, most of the common ones, at least) current
browsers on all platforms.
Christian
> But this works only in Mozilla-based browsers, right? I need something that works in ALL (well, most of the common ones, at least) current browsers on all platforms.
Platform independent bugs-free 99% reliable local File I/O interface? If
anyone gets a solution of this, don't post it here, but sell to Sun Java
for a good money. They are poking on the roses with it for a decade now,
and it's still buggy like hell. Too many issues are involved here, and
it would take a dozen of pages just to explain them (besides technical,
a lot of security related).
You have an easy solution with Windows systems with IE installed. Its
implementation of JavaScript (JScript) supports ActiveXObject, which
works just fine with local files. That would cover about 85% of the
potential customers.
The only totally universal solution would be to make a JavaScript editor
and provide an event-driven browser-dependent prompt like "Choose File >
Open to open the file you want to edit" and "Choose File > Save As to
save the changes you've made". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe |
last post by:
I am trying to read the EventLog of different servers on the network. If I
run the script in a command line, it works well. But when I try to put the
script into the Web server (IIS in Windows 2000) and run from a web browser,
it works with my local machine only. I have the following error when I try
to access any remote server:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The...
|
by: Otis Roth |
last post by:
----F34848E08D128A79C
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859=
-1">
|
by: Michael Winter |
last post by:
Below is the IDL definition of the HTMLOptionElement.
interface HTMLOptionElement : HTMLElement {
readonly attribute HTMLFormElement form;
attribute boolean defaultSelected;
readonly attribute DOMString text;
attribute long index;
attribute boolean disabled;
attribute DOMString label;
readonly attribute boolean selected;
|
by: rhat |
last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant.
Can anyone shed some light on what this will change and it will break stuff
as converting HTML to XHTML pages DO break things. see,
http://www.alistapart.com/articles/betterliving/
I read on
http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp
It said they changed stuff like this
|
by: Stefan Mueller |
last post by:
I'd like to read and modify a cell (e.g. 'Text 1') in the following HTML
table with a JavaScript:
==============================================
<html>
<body>
<table id = "MyTable">
<tr id = "Row1">
<td width = "40%">
| |
by: Mitch |
last post by:
I have some simple HTML I'm trying to read with the XMLTextReader. As in the
MSDS examples, I set up a loop to read each XML node:
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Console.WriteLine("<{0}>", reader.Name);
break;
|
by: Danil Dotsenko |
last post by:
Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's
SuperKaramba widget.
(http://www.kde-look.org/content/show.php?content=32185)
I was using 2.4.x python docs as reference and
ConfigParser.read('non-existent-filename') returns in 2.4.x
One user with 2.3.x reported an error stemming from my use of
len(cfgObject.read('potentially-non-existent-filename'))
|
by: Jim S |
last post by:
I have a need to read the contents of an html table on a remote web page into
a variable. I guess this is called screen scraping but not sure. I'm not
sure where to start or what the best practices are to accomplish this. For
instance; I have a healthcare app that need to check a gov't we page for a
user's license no# periodically. There is no login and I can put the user
info in the request URL no problem but not sure how to read the...
|
by: ZelluX |
last post by:
Hi, all
I'm confronted with some trouble when dealing with html files.
The html files contain javascript and some information stored in tables.
And it seems that they're not well-formed, when parsed with minidom, it
will say "mismatched tag".
Then how can i get information from those files? Is there any useful
library for me?
|
by: JosAH |
last post by:
Greetings,
It is strongly advised to download the first two links to your computer. The first link downloads Sun's Java Tutorial which is an almost mandatory read if you want to get started properly. Having the tutorial available locally can be a convenience even if you're offline.
The second link contains the API documentation of all the publicly available classes that come with the Java distribution. Without it you can't properly...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |