Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

`scriptLink` and `styleLink` strange behavior in Firefox #552

Closed
mewben opened this Issue Feb 23, 2014 · 2 comments

Comments

Projects
None yet
2 participants

mewben commented Feb 23, 2014

Hi, I followed the todo tutorial and found a strange issue in Firefox.
After generating the to_do scaffold and restarting the app, the scripts and styles in the head didn't load correctly.

I tried visiting http://localhost:4000/to_dos. It worked fine but in /todos/add, edit, or showing a todo item, the script and style wasn't located. It tries to load these url instead:

"NetworkError: 404 Not Found - http://localhost:4000/to_dos/%5Cjs%5Cbootstrap.min.js"
"NetworkError: 404 Not Found - http://localhost:4000/to_dos/%5Ccss%5Cstyle.css"

Strange.. But the app seems to be working fine with other browsers.

Here are some information about my dev machine by the way:

  • Windows 8.1 x64
  • Node v0.10.26
  • Geddy v0.12.5

Is there a way where we could use any baseUrl in rendering the scripts and styles so it returns an absolute path?

Please help.. Thank you..

Contributor

molda commented Feb 23, 2014

Are you using latest version of firefox?
I don't have a problem with that even when I use

<%- styleLink('\\css\\bootstrap.min.css', {rel:'stylesheet'}) %>

then the links looks like http://localhost:4000/\css\bootstrap.min.css and firefox loads it with no problem

best to use forward slashes in links

<%- styleLink('/css/bootstrap.min.css', {rel:'stylesheet'}) %>

or if you use variables

<%- styleLink(linkToMyCssFile, {rel:'stylesheet'}) %>

you could do

linkToMyCssFile = linkToMyCssFile.replace(path.sep, '/'); 
// path.sep in windows is double backslash \\

%5C is backslash
other browsers obviously have no problem with that but old versions of firefox seems not to handle it
old post http://forums.mozillazine.org/viewtopic.php?f=38&t=331740

mewben commented Feb 23, 2014

I have the latest version Firefox 27.0.1

Thanks.. the forward slashes fixed the issue..

@mewben mewben closed this Feb 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment