Solved

simple JavaScript webpage doesn't work

Posted on 2015-01-06
9
232 Views
Last Modified: 2015-01-06
Dear Experts,

here is a small page which uses JavaScript (and works fine):
http://tiny.cc/fah1rx

here is downloaded version of this page (and does not work):
http://www39.zippyshare.com/v/70694960/file.html

why the downloaded version doesn't work?
I am quite sure all files are downloaded and links are OK - at least in HTML, I do not know JS.

Could any JavaScript Expert please skim the source and tell me what needs to be modified to make it work?

many thanks for help!
Jarek
0
Comment
Question by:ja-rek
9 Comments
 
LVL 35

Assisted Solution

by:Kimputer
Kimputer earned 25 total points
ID: 40533317
Downloaded zip file, extracted in a folder, ran attack441.htm, saw all the 4 moves (essentially more moves though).
I.e. I don't understand your problem, it works as it should.
0
 
LVL 1

Author Comment

by:ja-rek
ID: 40533342
Hi Kimputer,

first of all thank you for willingness to help me!

on the left side of the window (left frame) there is a board with pieces.
below the board there is a line of six buttons - first one is "Start", last one is "End"
In between there is a ">" button.
When I am pressing the ">" button using online version, pieces move on the board.
Nothing happens after pressing button in offline version.

thanks again!
0
 
LVL 4

Assisted Solution

by:hulsebosch
hulsebosch earned 25 total points
ID: 40533352
The script works just fine.
I think your browser is blocking a script.
What browser are you using?
0
 
LVL 38

Assisted Solution

by:Tom Beck
Tom Beck earned 50 total points
ID: 40533353
It fails in Chrome. You are up against the "Same origin policy" with regard to the use of frames and local files. It's a security feature. There's no easy fix. This should really be done with one html page divided into left and right containers.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 22

Assisted Solution

by:Snarf0001
Snarf0001 earned 400 total points
ID: 40533354
Are you running this through Chrome?
If so, you're most likely having cross domain issues.  If you're running this right from a file system (ie not through a web server, even a local one), Chrome will block cross-frame javascript access to null domains.

IE / Firefox will allow the access, Chrome doesn't
0
 
LVL 1

Author Comment

by:ja-rek
ID: 40533358
I am using Chrome - both for the online and offline version.
I have now opened it in Firefox and works fine.
Is there a way to view it in Chrome e.g. by changing some security setting?
0
 
LVL 22

Accepted Solution

by:
Snarf0001 earned 400 total points
ID: 40533388
Security setting no, but you can temporarily disable it with command line arguments.
Find where Chrome is on your system, most likely Program Files (x86)\Google\Chrome\Application

Open a command prompt and go to that directory, and start chrome from the command line like this:

chrome.exe --allow-file-access-from-files --disable-web-security

You HAVE to have all chrome windows closed before running this.
That should give you a warning about reduced security, but let you run the script.
0
 
LVL 1

Author Comment

by:ja-rek
ID: 40533416
thanks Snarf0001, it works!

Just one clarification:
it seems --disable-web-security no longer works (Chrome displayed a message)
but  --allow-file-access-from-files is enough to make it work.
0
 
LVL 1

Author Closing Comment

by:ja-rek
ID: 40533672
thanks again for help!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now