(This is a re-post of something that apparently did not post correctly
the first time, so if there's more than one copy, please ignore the
duplicate).
I normally use Mozilla 1.4 on Windows XP Pro.
As I was developing some test webpages, I discovered that the SRC
parameter doesn't seem to work when a path is used with the filename.
In one example, when I want to run a JavaScript from an external file
(i.e., not inline), I would do the following ...
<SCRIPT LANGUAGE="JavaS cript" SRC="program.js "> </SCRIPT>
If "program.js " were in a different subdirectory than the .htm file
referring to it, the filename would have to be prefixed by the
pathname as follows ...
<SCRIPT LANGUAGE="JavaS cript" SRC="/mydir/program.js"> </SCRIPT>
But when I ran the above from within an .htm file loaded locally into
Mozilla, it did not work. (The result was as if the above code weren't
there). However, when I ran the identical code on Internet Explorer
(v.6), it worked.
In another, even simpler example, the code to put an image on a
webpage is ...
<img src="picture.jp g">
Again, if "picture.jp g were in a different subdirectory than the .htm
file referring to it, the filename would have to be prefixed by the
pathname as follows ...
<img src="/mydir/picture.jpg">
When I ran the above from within an .htm file loaded locally into
Mozilla, it did not work. (The result was as if the above code weren't
there). However, when I ran the identical code on Internet Explorer
(v.6), it worked.
By the way, I tried using backslashes instead of forward slashes. In
both cases, it still worked on Internet Explorer but not on Mozilla.
The SRC parameter seems like a fairly frequently used parameter for
the developers of Mozilla to overlook it. Is this really a bug in
Mozilla or is it just some option/switch in Mozilla that I didn't set
properly?
_______________ _______________ ____
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 13 3308
wylbur37 said: The SRC parameter seems like a fairly frequently used parameter for the developers of Mozilla to overlook it. Is this really a bug in Mozilla or is it just some option/switch in Mozilla that I didn't set properly?
Neither.
An URL beginning with a "/" is invalid. Since it isn't relative to
the URL of the current page, you must specify the protocol. IE lets
you get away with it, assuming that you mean the "file:" protocol.
There are many reasons why it's bad for a browser to make that sort
of assumption, but they are balanced by the fact that accepting bad
code will trick some people into thinking that the other browsers
are buggy, and so they will be less likely to support them, giving
the more lenient browsers a market advantage.
The correct tag would be:
<script type="text/javascript" src="file:///C:/mydir/program.js">
You should see that format in the Location bar when you open any
local HTML file.
Lee <RE************ **@cox.net> writes: An URL beginning with a "/" is invalid. Since it isn't relative to the URL of the current page, you must specify the protocol. IE lets you get away with it, assuming that you mean the "file:" protocol.
It is not invalid in general. As an URI fragment, it defines an
absolute path, relative to the current protocol and server. It is
correct for IE to assume the "file" protocol and "localhost"
server. Where it gets dicey is what happens on local files.
If the URL to the local file is
file://localhost/c:/somedire/myhtml/foo.html
then using the URI fragment in that context "/mydir/program.js" should
give
file://localhost/mydir/program.js
That is most likely not what is wanted. For one thing, it doesn't include
a drive letter. I guess it is what Mozilla does (ok, let me check ... yes,
it gives
file:///mydir/program.js
which is equivalent - omitting the server name in a file protocol means
the server is localhost).
If you compare it to IE, the same test gives:
file:///D:/mydir/program.js
(my test file was on the D: drive). That is incorrect according to
the definition of URIs, but obviously works better on windows based
machines.
Mozilla also runs on, e.g., Unix machines, where there are no drive
letters, so I can see why the want to keep the code general.
There are many reasons why it's bad for a browser to make that sort of assumption, but they are balanced by the fact that accepting bad code will trick some people into thinking that the other browsers are buggy, and so they will be less likely to support them, giving the more lenient browsers a market advantage.
Hear, hear!
<script type="text/javascript" src="file:///C:/mydir/program.js">
The problem is that you need to change the file before uploading
to a server. The advantage is that it works locally :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
On 2 Jan 2004 07:02:37 -0800, Lee <RE************ **@cox.net> wrote: An URL beginning with a "/" is invalid. Since it isn't relative to the URL of the current page, you must specify the protocol. IE lets you get away with it, assuming that you mean the "file:" protocol.
That statement is incorrect as long as the document has a base URL; either
specified explicitly or derived from the document (it's file: or http:
URL). A URL beginning with a single forward slash would be parsed like so:
base: http://www.example.com/html/main.html
abs: /mydir/picture.jpeg -> http://www.example.com/mydir/picture.jpeg
If 'mydir' was a subdirectory in 'html', the relative URL should be:
rel: ./mydir/picture.jpeg -> http://www.example.com/html/mydir/picture.jpeg
OR:
rel: mydir/picture.jpeg
You were correct though that a URL beginning with a forward slash is not
relative.
Using the file: scheme, the results should be similar: a single slash
would begin from the root directory of the current drive. However, RFC
1808 doesn't give examples for the file: scheme (probably due to numerous
and dissimilar filesystem formats).
<snip>
Mike
RFC 1808: http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1808.html
There is a list of examples towards the end of the document
(Section 5.1 - Normal Examples) that include a single, initial
forward slash.
--
Michael Winter M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
On Fri, 02 Jan 2004 17:37:04 +0100, Lasse Reichstein Nielsen
<lr*@hotpop.com > wrote: <script type="text/javascript" src="file:///C:/mydir/program.js">
The problem is that you need to change the file before uploading to a server. The advantage is that it works locally :)
However, the simple thing is to mirror the directory structure on the
server on the development machine(s) as well (it's what I do). If you only
use relative URLs, with '../' used as necessary, you need to change
nothing, and it works locally, too. Of course, you need to plan your
directory structures carefully first, but shouldn't you always do that?
Mike
--
Michael Winter M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
wylbur37 wrote: I normally use Mozilla 1.4 on Windows XP Pro. As I was developing some test webpages, I discovered that the SRC parameter doesn't seem to work when a path is used with the filename.
In one example, when I want to run a JavaScript from an external file (i.e., not inline), I would do the following ...
<SCRIPT LANGUAGE="JavaS cript" SRC="program.js "> </SCRIPT>
If "program.js " were in a different subdirectory than the .htm file referring to it, the filename would have to be prefixed by the pathname as follows ...
<SCRIPT LANGUAGE="JavaS cript" SRC="/mydir/program.js"> </SCRIPT>
But when I ran the above from within an .htm file loaded locally into Mozilla, it did not work. (The result was as if the above code weren't there). However, when I ran the identical code on Internet Explorer (v.6), it worked.
"/mydir/program.js" is an absolute path. On your server this is ok if
the url is "www.yoursite.c om/mydir/program.js". But on the local machine
mydir is searched in the root dir - wherever this may be on Windows
machines (not C: at least on Win98).
Opera shows same results and I guess that's right.
Christian
Michael Winter <M.******@bluey onder.co.invali d> writes: However, the simple thing is to mirror the directory structure on the server on the development machine(s) as well (it's what I do). If you only use relative URLs, with '../' used as necessary, you need to change nothing, and it works locally, too.
Yes, as long as the paths are in relation to the HTML file, it is
simple. However, if your javascript files contain paths as well, it
becomes difficult. E.g., this code in an external file:
function makeMyImg() {
var img = new Image();
img.src = "../images/myImage.png";
return img;
}
The problem is that when that code is called from an HTML page, the path
is taken relative to the HTML file, not the Javascript file. If you have
HTML files in different levels of directories, no relative path will
work for all of them. That makes absolute paths necessary for Javascript
files that are shared between different pages.
Of course, you need to plan your directory structures carefully first, but shouldn't you always do that?
Absolutely. And always sooner than you expect :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
In article <hd**********@h otpop.com>, lr*@hotpop.com enlightened us
with... The problem is that when that code is called from an HTML page, the path is taken relative to the HTML file, not the Javascript file. If you have HTML files in different levels of directories, no relative path will work for all of them. That makes absolute paths necessary for Javascript files that are shared between different pages.
Actually, I always use relative paths because of portability, and I had
to write a workaround to just this problem.
What I did was basically check where I was and write the source element
dynamically.
It was a server-side solution (coldfusion), but I bet it could be done
client-side as well, if needed.
--
--
~kaeli~
Condoms should be used on every conceivable occasion. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
"Christian Eyrich" <VJ**********@s pammotel.com> wrote in message
news:bt******** ****@ID-205057.news.uni-berlin.de...
<snip> ... But on the local machine mydir is searched in the root dir - wherever this may be on Windows machines (not C: at least on Win98).
<snip>
If you look at a file protocol URL on a Windows machine, such as -
file:///C:/mydir/program.js
- you may notice that the "file:" part is separated from the rest of
the URL by three slashes instead of the two that would usually be in
that location. The last of those three slashes represents the root
directory and as that is above the level of the drive letter it clearly
cannot represent any real location in the file system of a windows
machine. IE browsers seem to confuse the issue by applying the same path
rules that the OS uses when resolving file names.
Richard. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: wylbur37 |
last post by:
I normally use Mozilla 1.4 on Windows XP Pro.
As I was developing some test webpages, I discovered that the SRC
parameter doesn't seem to work when a path is used with the filename.
In one example, when I want to run a JavaScript from an external file
(i.e., not inline), I would do the following ...
<SCRIPT LANGUAGE="JavaScript" SRC="program.js"> </SCRIPT>
If "program.js" were in a different subdirectory than the .htm file
|
by: Randell D. |
last post by:
HELP!
Its taken me ages - I'm a newbie and I've compiled bits of code that I've
read in this newsgroup over time to create one of my most intricate
functions to date...
Basically, the script gets called with a single arguement (full path to an
image). The image is supposed to be downloaded to the cache, and when
complete, a new window opened that is slightly larger insize then the images
dimensions... The new window will contain the...
|
by: schieco |
last post by:
The following code always prints the debug lines inside the
conditional if statement before and after the alert statement when the
session has timed out, but the alert and redirect only appear/work in
certain situations.
<%
// Check for expired session
log.debug("session ID = " + session.getAttribute("session_loginID"));
if (session.getAttribute("session_loginID") == null)
|
by: Mark Olbert |
last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an
autopostback checkbox, for that matter).
I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for
that installed (and it looks like the code generated by ASP.NET when it renders the page does the
same thing, namely, setting document<). However, the
problem still exists under firefox.
Has anyone come...
|
by: JohnnyGr |
last post by:
I have heard theres a new way to start threads with parameters in
framework 2.0, does anyone know how to do that?
this is what i need to do...
Start a thread that executes some stuff, in this case it does gets all
files from a directory. then i need to update the GUI with information
from the thread...
the thread should be started with a parameter, in this case its a string
| |
by: logik3x |
last post by:
I'm developping a program to automate the submisson of grades to a
website called omnivox.ca (http://brebeuf.omnivox.ca). My problem is
that I can't get the login working. I get the cookie right and the post
data is corect. But when I sniff the http packet it contains not post
data and he response is not the same. Here are the sniffed post
packets.
POST from IE6
(Request-Line):POST
/Estd/Default.aspx?C=BRE&E=P&L=FRA&Ref=20051122161245...
|
by: =?Utf-8?B?QmlsbEF0V29yaw==?= |
last post by:
Hi,
We recently converted a 1.1 project to 2.0 and this included a webservice
which accepted XML for one of the parameters. Since converting to 2.0 I am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---
The fix used for ASPX pages is to include the @Page directive with
|
by: pmadhu512 |
last post by:
hi below code is working in the IE6 and mozilla but not working IE7.when i moving the mouse to the block the popup getting closed
could you please help me how to resolve this problem
<div class="plus_addition">
<div class="plusindicator " onmouseover="openPlusPopup('pluspopup_<c:out value="${uniqueId}"/>')" onmouseout="closePlusPopup('pluspopup_<c:out value="${uniqueId}"/>')">
<a...
|
by: Sarah |
last post by:
I was wondering if someone might be able to help me with this issue.
I have a feeling this has something to do with my host's server
settings as I used to be able to get CURL to follow redirects by
setting CURLOPT_FOLLOWLOCATION set to true. I had a problem with my
host's updating something in the past that gave me the error
"CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an
open_basedir is set". My host worked on the...
|
by: happyse27 |
last post by:
Hi All,
I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c.
Not sure where went wrong as the web page displayed internal server error.
Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |