jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.51k stars 748 forks source link

Load Failed:Error:Expected "=" after attribute name #200

Closed ibirnam closed 11 years ago

ibirnam commented 11 years ago

A pair of students are getting this error when they try to load their HW3 file. The project is saved on Courtney's account.

Usernames: courtneyrae23 allanazarenko

Project name: HW3 Progress

Picture of error is below as well: cs10

jmoenig commented 11 years ago

duplicate of #171

jmoenig commented 11 years ago

Looks like we've fixed this bug in the cloud backend now, as it hasn't happened to any project that was saved or modified after we introduced the change. Unfortunately broken projects will remain so. You can however, still delete them from your account if you wish. I'm closing all of these related issues now. Thanks for your reports!

seteahconnoc commented 4 years ago

Hello. I have got a problem with preloading a project when starting "Snap!". It 's just:

untitled script pic

As mentioned in section G of the manual, there are four "verbs". Using the verbs "cloud" and "present" in the "Snap!" cloud is working just fine. I exported my project and put the xml file on a website which is publicly accessable. This is the example URL from the manual:

https://snap.berkeley.edu/snap/snap.html#open:http://snap.berkeley.edu/snapsource/Examples/vee.xml

So, I tested it with me exported project (replacing the part after the hashtag):

Any advice would be helpful. Thanks in advance.

jguille2 commented 4 years ago

Hi @seteahconnoc ,

Two issues here:

Then , @brianharvey , maybe our manual must be fixed.

Joan

cycomachead commented 4 years ago
  • Otherwise, you'll get a CORS error.
  • ...projects that have been exported and made available on the same web domain Snap! is running"

Not quite. Any non-Snap! server should be fine, as long at it meets 2 conditions:

The following links are hopefully helpful:

Also, http://extenstions.snap.berkeley.edu is a subdomain which is specifically designed not to need https.

brianharvey commented 4 years ago

On 4/26/20 5:38 PM, Michael Ball wrote:

Also, http://extensions.snap.berkeley.edu http://extenstions.snap.berkeley.edu is a subdomain which is specifically designed not to need https. Is this published information?  I.e., should I put it in the manual?

bromagosa commented 4 years ago

Is this published information? I.e., should I put it in the manual?

Yep! A bunch of hardware (and other) extensions have been using that domain for a long time already.


@seteahconnoc as a friendly reminder, your question is totally unrelated to the original issue. It took me a bit to understand this had nothing to do with broken XMLs. Also, we now have a forum for questions: forum.snap.berkeley.edu/ :)

seteahconnoc commented 4 years ago

@bromagosa Thanks for the advice. I just did an internet search for the error message, and the issue title was an exact match. But for the future, I'll keep this in mind.

seteahconnoc commented 4 years ago

Thank you very much for all the quick responses. Right now, I have to figure out, what to do.

@cycomachead You wrote:

Not quite. Any non-Snap! server should be fine, as long at it meets 2 conditions:

  • served over https
  • Allows CORS requests. As long as the site snap is requesting from sends the right header, files can be read.

I think, these two conditions are met in my case: I'm using https webspace. A PHP file named index.php is handling requests. You can see, that I've dealt with the CORS requirements.

<?php
 header("Access-Control-Allow-Origin: *");

  $filename = $_GET['filename'];
  $type = $_GET['type'];

  if($type == "write")
  {
    $file = fopen($filename,"w");
    $content = $_GET['content'];
    fputs($file,$content);
    $ok = fclose($file);
    if($ok) echo "ok"; else echo "ERROR: cannot write";
  }

[...]

?>

So, I am able to do this:

untitled script pic (1)

Sending this request via

https://snap.berkeley.edu/snap/snap.html

is working just fine. Right now, the content of thisfilename.txt changed to hello. So, I thought that this line would get things running:

https://snap.berkeley.edu/snap/snap.html#run:https://www...[mywebspace]...de/test.xml

But sadly, there 's no success at this point. As mentioned above, theres this error message:

Load Failed:Error:Expected "=" after attribute name


@bromagosa BTW: I've read and successfully tested this inspiring blog entry

http://microblocks.fun/blog-2020-01-15-microblocks,-snap!,-and-the-web

So, I'm aware of: http://extensions.snap.berkeley.edu (In fact, this github issue is related to a physical computing issue with MicroBlocks and an ESP32.) As you have already expected, I'm not an expert in the differences of https and http, so I just did this:

http://extensions.snap.berkeley.edu/snap.html#run:http://www...[mywebspace]...de/test.xml

Still, there's no success.

jguille2 commented 4 years ago

Yes Michael (@cycomachead)! My proposal was bad. But then, we need a more complete explanation... Something like:

And @seteahconnoc , maybe you can share your URL test (now it says "...[mywebspace]...") to test and find the problem.

Joan

cycomachead commented 4 years ago

I believe the issue in this case is that #run needs to be #open. Unless I am misremembering, I think they still handle different “types” of project references differently.

-- Michael Ball From my iPhone michaelball.co

On Apr 27, 2020, at 2:17 AM, Joan Guillén i Pelegay notifications@github.com wrote:

 Yes Michael (@cycomachead)! My proposal was bad. But then, we need a more complete explanation... Something like:

"served over https" could be "served over https if your Snap! is also running in that way. You have online alternatives as http://extensions.snap.berkeley.edu/snap.html" -"Allow CORS requests...." must be "Allow CORS request if Snap! is not running over the same domain...." Maybe my words are not the best... And @seteahconnoc , maybe you can share your URL test (now it says "...[mywebspace]...") to test and find the problem.

Joan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

seteahconnoc commented 4 years ago

https://snap.berkeley.edu/snap/snap.html#run:https://www.christian-hanken.de/test.xml is leading me to this result: Load Failed:Error:Expected "=" after attribute name

https://snap.berkeley.edu/snap/snap.html#open:https://www.christian-hanken.de/test.xml is leading me to a white screen.

jguille2 commented 4 years ago

Hi @seteahconnoc ,

But in those test examples, there is no the CORS requirement. And then, this is the problem

See https://www.christian-hanken.de/test.xml and its header response!

Joan

seteahconnoc commented 4 years ago

@jguille2 (Sorry, but I need a little more information. Obviously, I'm not understanding every detail of the http(s) and CORS mechanisms.) Is this the header response that you mentioned?

This XML file does not appear to have any style information associated with it.

I just exported a "Snap!" project and put it on my webspace. I'm assuming that that wasn't enough. What would be the next step?

cycomachead commented 4 years ago

See https://www.christian-hanken.de/test.xml and its header response!

This site also doesn't have CORS enabled which is why the same error happens.

Without the URL it is going to be difficult to debug the error your project is having.

seteahconnoc commented 4 years ago

I remember dealing with these http(s)/CORS issue while setting up the url block I mentioned earlier above. So, I thought: If my old url block is able to communicate with the PHP script on my webspace, the http(s)/CORS configuration would be alright. - But obviously, there 's something else to adjust.

Giving you more information on this case would be no problem: You already got the URL / location. What else is necessary?


I really appreciate your efforts in helping. In my experience, web accessability of "Snap!" projects is really important, but not every casual "Snap!" user wants to use the "Snap!" cloud (although it is a quite inviting place).

cycomachead commented 4 years ago

I tried reading through the thread but didn’t see the specific URL just an example.

-- Michael Ball From my iPhone michaelball.co

On Apr 27, 2020, at 11:21 PM, seteahconnoc notifications@github.com wrote:

 I remember dealing with these http(s)/CORS issue while setting up the url block I mentioned earlier above. So, I thought: If my old url block is able to communicate with the PHP script on my webspace, the http(s)/CORS configuration would be alright. - But obviously, there 's something else to adjust.

Giving you more information on this case would be no problem: You already got the URL / location. What else is necessary?

I really appreciate your efforts in helping. In my experience, web accessability of "Snap!" projects is really important, but not every casual "Snap!" user wants to use the "Snap!" cloud (although it is a quite inviting place).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

seteahconnoc commented 4 years ago

I guess, this might be a misunderstanding. I thought, this might be helpful: https://www.christian-hanken.de/test.xml This is, where my example project "text.xml" is located on my webspace.

jguille2 commented 4 years ago

Hi @seteahconnoc , I try to explain a little more...

You said you dealt with CORS doing

 <?php
 header("Access-Control-Allow-Origin: *");

But you are doing this only in your (all or some) PHP responses. But when you request a file to your server, it is not adding that header to its responses.

So, you must implement CORS (if you want) at server level. For example, in Apache, you can add this directive to your "directory", "virtualhost"... at *.conf files or inside a .htaccess file. More info.

Joan

seteahconnoc commented 4 years ago

Thanks for clarifying explanation. That would be all for this moment. I remember reading these things while implementing my PHP code. Right now, I have to figure out my next steps. But that could take some time. Luckily, there 's still the "Snap!" cloud.