Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31977 > unrolled thread

Firefox external script files question

Started by"Mel Smith" <syntel@cox.net>
First post2016-12-26 10:14 -0700
Last post2016-12-27 15:14 +0700
Articles 9 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Firefox external script files question "Mel Smith" <syntel@cox.net> - 2016-12-26 10:14 -0700
    Re: Firefox external script files question "Mel Smith" <syntel@cox.net> - 2016-12-26 10:49 -0700
      Re: Firefox external script files question "Mel Smith" <syntel@cox.net> - 2016-12-26 11:01 -0700
    Re: Firefox external script files question Luuk <luuk@invalid.lan> - 2016-12-26 19:57 +0100
      Re: Firefox external script files question "Mel Smith" <syntel@cox.net> - 2016-12-26 12:48 -0700
        Re: Firefox external script files question Luuk <luuk@invalid.lan> - 2016-12-26 20:56 +0100
    Re: Firefox external script files question "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-12-26 12:50 -0800
      Re: Firefox external script files question "Mel Smith" <syntel@cox.net> - 2016-12-26 16:01 -0700
    Re: Firefox external script files question JJ <jj4public@vfemail.net> - 2016-12-27 15:14 +0700

#31977 — Firefox external script files question

From"Mel Smith" <syntel@cox.net>
Date2016-12-26 10:14 -0700
SubjectFirefox external script files question
Message-ID<ecd1g0F53pqU1@mid.individual.net>
Hi All:

Problem:
    When testing on a *local* machine with no server involvement, my FireFox 
browser (version 50.1.0) *cannot* locate my external script files.  However, 
IE and Chrome can easily do so.

Question:
    In the page below, and considering that FF is started locally and 
activates the page below,

    Where does FF look for the needed external script files ?

    (The external script files are located locally in C:\SCRIPTS\ and also 
in C:\eml\forms\scripts\ sub-directory)


****** top fragment of html page 'eml.htm' located in C:\eml\forms\ 
sub-dir****
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Resident Login Page</title>

<script src="/scripts/utilsmin.js" type="text/javascript"></script>

******* end of fragment *****


Here is how the page is activated by FF from within a batch file located in 
the C:\EML\  project sub-directory

\Progra~1\Mozill~1\FIREFOX c:\eml\forms\eml.htm

This batch file is located in C:\EML.

Again, the script files are located in C:\SCRIPTS\ and also in 
C:\eml\forms\scripts\

Here is the Chrome activation that works correctly and reads the same script 
files correctly:

C:\PROGRA~1\Google\Chrome\Application\chrome.exe c:\eml\forms\eml.htm

... and here is the IE activation:

explorer c:\eml\forms\eml.htm

    Both Chrome and IE work perfectly, but FF cannot read the script files 
and just skips by them ...

Thanks,

-Mel Smith
(re-starting ECMAScript programming after 4 years away. What a head-smasher 
:((  )


[toc] | [next] | [standalone]


#31980

From"Mel Smith" <syntel@cox.net>
Date2016-12-26 10:49 -0700
Message-ID<ecd3i6F5jcmU1@mid.individual.net>
In reply to#31977
Stefan said:

>
>  What about relative paths?
>
> src = "scripts/utilsmin.js"?

Just ried relative path. Didn't work.


>
>  Or an absolute path with the file protocol?
>
>  Maybe you need to set security.fileuri.strict_origin_policy
>  to false?
    I don't know how to do the above.

    BUT, I just installed a few minutes ago the Safari 5.34.57.2 browser, 
and it, too, works perfectly.

    There is something weird about FF that doesn't bother the other browsers 
at all !

    Also, if I temporarily and quickly place the page on the 'real' server, 
and visit the page, FF runs correctly !  But I have to remove it and use the 
placeholder page for a few more months until I get this project up and 
running.

Thanks for the suggestions.
    (and rather the put up a local server, I guess I'm going to do my 
testing on the other browsers and forget about FF for now. What a pity :(  )

-Mel Smith

[toc] | [prev] | [next] | [standalone]


#31981

From"Mel Smith" <syntel@cox.net>
Date2016-12-26 11:01 -0700
Message-ID<ecd47kF5odsU1@mid.individual.net>
In reply to#31980
Hi Stefan:
>    BUT, I just installed

>>  Maybe you need to set security.fileuri.strict_origin_policy
>>  to false?
>    I don't know how to do the above.
>

    I just found and toggled this setting. It made no difference. FF still 
failed to read the script file..

-Mel Smith

[toc] | [prev] | [next] | [standalone]


#31982

FromLuuk <luuk@invalid.lan>
Date2016-12-26 19:57 +0100
Message-ID<58616804$0$21445$e4fe514c@news.xs4all.nl>
In reply to#31977
On 26-12-16 18:14, Mel Smith wrote:
> Hi All:
>
> Problem:
>     When testing on a *local* machine with no server involvement, my FireFox
> browser (version 50.1.0) *cannot* locate my external script files.  However,
> IE and Chrome can easily do so.
>
> Question:
>     In the page below, and considering that FF is started locally and
> activates the page below,
>
>     Where does FF look for the needed external script files ?
>
>     (The external script files are located locally in C:\SCRIPTS\ and also
> in C:\eml\forms\scripts\ sub-directory)
>
>
> ****** top fragment of html page 'eml.htm' located in C:\eml\forms\
> sub-dir****
> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="UTF-8">
> <title>Resident Login Page</title>
>
> <script src="/scripts/utilsmin.js" type="text/javascript"></script>
>
> ******* end of fragment *****
>
>

Try to change this:
<script src="/scripts/utilsmin.js" type="text/javascript"></script>
to this:
<script src="scripts/utilsmin.js" type="text/javascript"></script>

the script should execute from C:\eml\forms\scripts\

at least a similar thing works on my Windows10 computer ....

>
> -Mel Smith
> (re-starting ECMAScript programming after 4 years away. What a head-smasher
> :((  )
>
>
>

[toc] | [prev] | [next] | [standalone]


#31983

From"Mel Smith" <syntel@cox.net>
Date2016-12-26 12:48 -0700
Message-ID<ecdah8F77k1U1@mid.individual.net>
In reply to#31982
Luuk said:

>
> Try to change this:
> <script src="/scripts/utilsmin.js" type="text/javascript"></script>
> to this:
> <script src="scripts/utilsmin.js" type="text/javascript"></script>
>
> the script should execute from C:\eml\forms\scripts\
>
> at least a similar thing works on my Windows10 computer ....
>

Hi Luuk:

    Your suggested  change *WORKED* !    !

    But, my C:\eml\forms\scripts was *empty*.  (Apologies to Stefan)

    So, I copied all of c:\scripts\ to c:\eml\forms\scripts\ and then made 
the change to remove the leading '/', and it *worked*.

Question: WHY does FF work in this fashion when the other browsers don't 
need the 'slash' removed ??  and what is the path it searche when run 
locally. I would really like to know this ?

    and what will happen when I move it to/from the actual network server. I 
suppose it will fail unless I re-insert the 'slash' again . I'll have to 
check it out.

Thank you and Stefan for your help !

-Mel Smith

[toc] | [prev] | [next] | [standalone]


#31984

FromLuuk <luuk@invalid.lan>
Date2016-12-26 20:56 +0100
Message-ID<586175fd$0$21519$e4fe514c@news.xs4all.nl>
In reply to#31983
On 26-12-16 20:48, Mel Smith wrote:
> Luuk said:
>
>>
>> Try to change this:
>> <script src="/scripts/utilsmin.js" type="text/javascript"></script>
>> to this:
>> <script src="scripts/utilsmin.js" type="text/javascript"></script>
>>
>> the script should execute from C:\eml\forms\scripts\
>>
>> at least a similar thing works on my Windows10 computer ....
>>
>
> Hi Luuk:
>
>     Your suggested  change *WORKED* !    !
>
>     But, my C:\eml\forms\scripts was *empty*.  (Apologies to Stefan)

LOL ...

>
>     So, I copied all of c:\scripts\ to c:\eml\forms\scripts\ and then made
> the change to remove the leading '/', and it *worked*.
>
> Question: WHY does FF work in this fashion when the other browsers don't
> need the 'slash' removed ??  and what is the path it searche when run
> locally. I would really like to know this ?
>
>     and what will happen when I move it to/from the actual network server. I
> suppose it will fail unless I re-insert the 'slash' again . I'll have to
> check it out.
>
> Thank you and Stefan for your help !
>
> -Mel Smith
>
>

if your scripts are in 'script/somescript.js' nothing needs to be 
change, because the files will be found relatieve to the document.

[toc] | [prev] | [next] | [standalone]


#31988

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2016-12-26 12:50 -0800
Message-ID<270dc0e3-ecd1-4965-acd9-c2a2921f393f@googlegroups.com>
In reply to#31977
On Monday, December 26, 2016 at 11:14:45 AM UTC-6, Mel Smith wrote:
> Hi All:
> 
> Problem:
>     When testing on a *local* machine with no server involvement, my FireFox 
> browser (version 50.1.0) *cannot* locate my external script files.  However, 
> IE and Chrome can easily do so.
> 
> Question:
>     In the page below, and considering that FF is started locally and 
> activates the page below,
> 
>     Where does FF look for the needed external script files ?
> 
>     (The external script files are located locally in C:\SCRIPTS\ and also 
> in C:\eml\forms\scripts\ sub-directory)
> 
> 
> ****** top fragment of html page 'eml.htm' located in C:\eml\forms\ 
> sub-dir****
> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="UTF-8">
> <title>Resident Login Page</title>
> 
> <script src="/scripts/utilsmin.js" type="text/javascript"></script>
> 
> ******* end of fragment *****
> 
> 
> Here is how the page is activated by FF from within a batch file located in 
> the C:\EML\  project sub-directory
> 
> \Progra~1\Mozill~1\FIREFOX c:\eml\forms\eml.htm
> 
> This batch file is located in C:\EML.
> 
> Again, the script files are located in C:\SCRIPTS\ and also in 
> C:\eml\forms\scripts\
> 
> Here is the Chrome activation that works correctly and reads the same script 
> files correctly:
> 
> C:\PROGRA~1\Google\Chrome\Application\chrome.exe c:\eml\forms\eml.htm
> 
> ... and here is the IE activation:
> 
> explorer c:\eml\forms\eml.htm
> 
>     Both Chrome and IE work perfectly, but FF cannot read the script files 
> and just skips by them ...
> 
> Thanks,
> 
> -Mel Smith
> (re-starting ECMAScript programming after 4 years away. What a head-smasher 
> :((  )

You're on Windows... Use IIS and save yourself this drama (or an IDE that creates an http://localhost:xxxx url for you)

The "problem" is due to new security constraints in some browsers that treat file system paths as different domains. 

1. Enable IIS <https://www.iis.net/learn/install/installing-iis-7/installing-iis-on-windows-vista-and-windows-7>
2. Create a new local website: <https://www.iis.net/learn/get-started/getting-started-with-iis/create-a-web-site>
2a. I suggest using your login credentials for the website binding to avoid filesystem access errors
2b. I also suggest the url format be of a form without a TLD: <http://my-site>
3. copy the url you created and put it in your hosts file: <C:\Windows\System32\drivers\etc\hosts> and point the IP address to 127.0.0.1
4. Profit. Your webpage can now run like a normal one on the interwebs.

[toc] | [prev] | [next] | [standalone]


#31992

From"Mel Smith" <syntel@cox.net>
Date2016-12-26 16:01 -0700
Message-ID<ecdlpjF9r3kU1@mid.individual.net>
In reply to#31988
Michael said:

> You're on Windows... Use IIS and save yourself this drama (or an IDE that 
> creates an http://localhost:xxxx url for you)
>
> The "problem" is due to new security constraints in some browsers that 
> treat file system paths as different domains.
>
> 1. Enable IIS 
> <https://www.iis.net/learn/install/installing-iis-7/installing-iis-on-windows-vista-and-windows-7>
> 2. Create a new local website: 
> <https://www.iis.net/learn/get-started/getting-started-with-iis/create-a-web-site>
> 2a. I suggest using your login credentials for the website binding to 
> avoid filesystem access errors
> 2b. I also suggest the url format be of a form without a TLD: 
> <http://my-site>
> 3. copy the url you created and put it in your hosts file: 
> <C:\Windows\System32\drivers\etc\hosts> and point the IP address to 
> 127.0.0.1
> 4. Profit. Your webpage can now run like a normal one on the interwebs.

Hi Michael:

    Because I'm running / testing corrctly now, I'll leave your detailed 
suggestions until life settld down a bit.

Thank you.

-Mel

[toc] | [prev] | [next] | [standalone]


#31996

FromJJ <jj4public@vfemail.net>
Date2016-12-27 15:14 +0700
Message-ID<34y4gyykzgvb.1u5l39s16znc3.dlg@40tude.net>
In reply to#31977
On Mon, 26 Dec 2016 10:14:38 -0700, Mel Smith wrote:
> 
> Problem:
>     When testing on a *local* machine with no server involvement, my FireFox 
> browser (version 50.1.0) *cannot* locate my external script files.  However, 
> IE and Chrome can easily do so.

The problem is as Luuk mentioned. Your SCRIPT element points to the wrong
path.

FireFox works as it should, but both IE (at least v8 and olders) and
Chrome50 do not.

I don't actually test Chrome50 since I don't have it yet, but I tested it in
IE8, FireFox45, and Chrome43.

However, it doesn't work in Chrome43. Which means that Chrome43 works as it
should, and the newer version is more buggy.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web