Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Paul_808

Internet Explorer Issue

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...