Paul_808 Posted September 3, 2012 Share Posted September 3, 2012 Hello, I'm having a bit of an unusual problem and I've spent hours trying to figure it out with no luck. I downloaded the scripts and then made a copy of them. In going through the exercises I open a sample file with Notepad ++ and delete the code but leave the comments. I then fill in the code after reading the book, Then I compare my script to the original and fix any mistakes I've made. My exercises work in Firefox and Chrome but when I test in Internet Explorer two exercises have not. The Explorer console gives me the following error: SCRIPT1014: Invalid character random.js, line 1 character 1. The script is identical to the original. Here's where it gets really weird, if I put the unaltered script in the js folder it works however even if I copy and paste the content of the unaltered script into the script I was working with I still get the error. I deleted the browsing history, I changed the path, I even restarted my computer and no luck. If anyone has any ideas as to what may be going on here I would appreciate them very much. Thanks! Paul Link to comment Share on other sites More sharing options...
Larry Posted September 3, 2012 Share Posted September 3, 2012 With that particular error, I suspect it has something to do with the encoding used by your application. That's the most common cause of an error on line 1, character 1. Link to comment Share on other sites More sharing options...
Paul_808 Posted September 3, 2012 Author Share Posted September 3, 2012 Thanks so much for the reply but I'm not sure that's the issue. There is an encoding menu item in Notepad++. Encode in ANSI is selected on both files. Both files are also set to UNIX. Link to comment Share on other sites More sharing options...
Larry Posted September 3, 2012 Share Posted September 3, 2012 Okay, but isn't the HTML page set to use UTF8 as the encoding? Link to comment Share on other sites More sharing options...
Paul_808 Posted September 4, 2012 Author Share Posted September 4, 2012 I changed the encoding to UTF8 (with and without BOM), deleted the browsing history and still got the same error. I then downloaded Aptana Studio. I created a new Javascript file in Aptana, copied and pasted the code from the unaltered file and received the same results, works in Firefox and Chrome, error in Explorer. Do you have any other suggestions? Thanks! Link to comment Share on other sites More sharing options...
HartleySan Posted September 4, 2012 Share Posted September 4, 2012 Does the script involve any server-based code? What are the scripts in particular that are giving you problems? Try running the scripts through a server or virtual server (i.e., localhost) and see what happens. Link to comment Share on other sites More sharing options...
Paul_808 Posted September 9, 2012 Author Share Posted September 9, 2012 The script does not involve any server based code. There have been several scripts giving me issues the last two are chapter 5 random and chapter 6 today. This time the unaltered .js file works in all browsers. As soon as I save it, it no longer works in any version of Explorer. In Notepad++ there is an encoding menu item. I selected convert to UTF-8 and saved the files. They are still not working in Explorer. I also tried to create a new file using Aptana Studio and no luck. I am stumped. Any other suggestions would be very much appreciated. Thank you. Link to comment Share on other sites More sharing options...
Paul_808 Posted September 9, 2012 Author Share Posted September 9, 2012 / Link to comment Share on other sites More sharing options...
Paul_808 Posted September 9, 2012 Author Share Posted September 9, 2012 It seems after much agony I have finally got my scripts to work in Explorer. Just changing the encoding under the encoding drop down and saving the file was not enough. I needed to change the default encoding settings (under settings>preferences>new document) to UTF8 without BOM. I tried a bunch of things but I think this was the solution. Link to comment Share on other sites More sharing options...
Recommended Posts