views:

434

answers:

7

Hi All,

I have a page that calls a script in the header, like so:

<script type="text/javascript" src="http://www.discoverfire.net/analytics/l/a.js"&gt;&lt;/script&gt;

(Note you will NOT be able to load this script as it is DND'd locally as a staging domain)

Very Simple.

Firefox, IE, Chrome all have no problem with this basic, square-one feature.

Opera, however, refuses to load the script. Any variables or functions in it are "undefined" and in dragonfly, the script tag is shown in the DOM, but the "Script" tab says "No script files found."

I go to google and find random pages, their external .js files seem to work just fine.

Any idea why Opera hates me? Is there a security/javascript thing I am missing?

A few things that may be relevant, but really should make no difference:

  • The script is on a different domain than the page.
  • The script is only available on my local network. The domain is DNS'd locally for staging, from outside the network it points somewhere else. Does Opera have a setting to secretly use an external DNS server?
  • The script works on every other browser I have.
  • The problem isn't in the script content. I've reduced it to a single line with an alert and it simply won't work in Opera.

Update:

OK, the problem seems to be how Opera treats the domain.

I have moved the script to several other domains, and it DOES work just fine. I've moved it to several paths on the locally DNS'd domain, and it won't work from anywhere on that domain.

This leads me to believe that the problem is that Opera can't, or won't, load the script from this domain for some reason.

Strangely, there seems to be no problem loading pages and other resources from the domain, the problem lies in .js files only.

The domain is registered, but parked. We DNS'd it locally so we can use it for staging/testing, and that may be messing with Opera somehow with JS security.

I could be wrong though - I really have no idea. If anyone else has one, I'd love to hear it.

Update 2:

Regarding Dragonfly and the error console/developer tools, they don't say anything about the script at all. There are plenty of Undefined Variable errors for variables and functions that should be present from the script, but other than that, no errors. Oddly, the script tag does show up in the DOMM, but if I click on the Scripts tab, it says "No Scripts Found".

Update 3:

There is no blocked content, so we can at least rule out that setting.

+2  A: 

You should ask in the Opera Forums. I had some problems with Opera in the past and they answered quickly.

miguelSantirso
Hey, good idea.
Eli
I have to agree. I use Opera regularly and occasionally my power will flicker just enough to reset my router. When that happens I have to un/re-plug the system to the router so that the system re-establishes the connection to get Opera to connect to anything outside my router.<br><br>It's the only browser I have that forces me to do that.
joebert
+2  A: 

You may want to see if its ad blocker is getting in the way. Your URL contains the text "analytics," which may be part of a "block this" pattern. I know some block Google analytics through Opera. An easy test for this may be to try moving your .js to a different path on the host.

Jacob
Hmm, that could be it. I don't see any settings for that though. I will definitely have a look - thanks for the idea!
Eli
+1  A: 

Is the host serving the correct mime type of the JavaScript file. It's not a commonly known fact but the type=text/javascript attribute is actually ignored by browsers as it trusts that the server is specifying the correct type.

Additionally the mime type of text/javascript is actually wrong when it comes to JavaScript, the actual JavaScript mime type is application/ecmascript (if I recall correctly, it may be application/javascript though). If you don't believe me you should have a look here where I had more information and linked off to the Douglas Crockfords videos where he discussed the mime type.

Slace
I will have to look into that. I don't think it's what's causing this particular problem (see edit above), but I will definitely check and start using the correct mime. Thanks!
Eli
+2  A: 

Have you checked Opera's error console? Tools > Advanced > Error Console It should provide information on why it won't load or if there another error of some kind.

Darryl Hein
I have. It doesn't say anything about the script in the developer tools at all. It has plenty of Undefined Variable errors for variables and functions that should be present from the script, but other than that, no errors. Oddly, it shows the script tag in the DOM, but if I click on the Scripts tab, it says "No Scripts Found".
Eli
Have you tried removing everything except may an alert in the file to see if maybe there is something wrong with the file?
Darryl Hein
+2  A: 

Like Jacob suggested, you should check if it isn't blocked. To do this:

  • Right-click on your page
  • Select "Block Content..." in the context menu
  • At the top of the screen, click the "Details..." button
  • You should see the URL's that are blocked on the current page
Tommy Carlier
Thank you - great idea. Nothing blocked though.
Eli
+1  A: 

I had something similar recently - opera would just not run a script on an external server... nor if I downloaded it and had it on localhost. It only ran when copy/pasted between script tags into the html page.

It turned out that the script was encoded with UTF-16 and that was somehow confusing the browser. When I converted it to UTF-8, everything ran fine.

So, just in case and if you still have that problem, check out the encoding settings...

I will, thanks! I've put that project on the back burner for a bit, but will be launching it shortly, and will have to test that out.
Eli
+1  A: 

I had the exact same issue, tying to load a script from a localhost/development server into a page, hosted on the public server at no avail. The only way I managed the script to load in Opera was to save a copy of the page into a location on the same development server and use the tag to refer to the original domain to get the page's .css and .js linked files. That worked. Looks like Opera doesn't like to mix public and localhost domains, but handles localhost without complaints.

LU.