Git Product home page Git Product logo

Comments (12)

cemerick avatar cemerick commented on July 21, 2024

Try (.log js/console "foo") and (.write js/document "foo").

from austin.

txrev319 avatar txrev319 commented on July 21, 2024

Same problem

(.log js/console "Hello") ;; returns nil, nothing happens

(.write js/document "Hello") ;; hangs

from austin.

txrev319 avatar txrev319 commented on July 21, 2024

What information can I provide to be of use?

(I realize what I have provided is useless for debugging. However, I'm not familiar with cljs-bcrepl debugging and do not know what to provide.)

from austin.

txrev319 avatar txrev319 commented on July 21, 2024
cljs.user=> js/document.URL
"http://localhost:3002/794/repl/start?xpc=...blahblahblah..."

Correct me if I'm wrong. This means when I do (.write js/document), I'm writing into the iframe not the original document.
Simiiarly, when I do (.log js/console) I'm logging into the console of the iframe and not the main document.

Is there a way to retrieve the "main document" that the iframe is embedded into?

Thanks!

from austin.

txrev319 avatar txrev319 commented on July 21, 2024

So I'm trying

js/parent

And I'm getting the following problem:

cemerick.austin is running on localhost:3002
webserver is running on localhost:3000

Thus, I'm getting a cross-domain iframe issue. Is there a way to put some javascript in my webpage to say "allow stuff from localhost:3002" ?

Thanks!

from austin.

txrev319 avatar txrev319 commented on July 21, 2024

With apologies for spamming the issue tracker, I believe the answer is:

http://stackoverflow.com/questions/5008944/how-to-add-an-access-control-allow-origin-header

from austin.

cemerick avatar cemerick commented on July 21, 2024

You have multiple issues going on. First, I cannot reproduce any problem with these expressions:

js/parent
(.log js/console "foo")

They produce the results I'd expect. Also, js/document.URL returns e.g. "http://localhost:38983/2420/repl/start", no xpc parameter.

The one thing I was able to reproduce is that:

(.write js/document "Hello World")

doesn't return: I need to interrupt the evaluation in order to get a prompt back, but the browser-repl is hosed at that point, and I need to :cljs/quit to get back to the Clojure REPL. However, the indicated text is written to the DOM. I don't have any explanations for that one; there's no cross-domain iframe problem here, since the text does appear, but there's definitely something about that expression that the browser-repl (probably client-side, since no response is returned) doesn't like.

w.r.t. the other problems you're having: what version of Chrome are you using? Can you provide a project and steps to reproduce?

from austin.

johnwalker avatar johnwalker commented on July 21, 2024

I haven't come across the other problems, but (.write js/document "aoeu") executes without termination for me as well.

This is probably because calling .write js/document overwrites the javascript in the page with

html
  head
  /head
  body
    aoeu
  /body
/html

This happens in the cljs-start template with no changes:
https://github.com/magomimmo/cljs-start

Chromium 31.0.1650.57
Mozilla Firefox 26.0
CIDER 0.5.0alpha (Clojure 1.5.1, nREPL 0.2.3)
[com.cemerick/austin "0.1.3"]
[org.clojure/clojurescript "0.0-2127"]

from austin.

txrev319 avatar txrev319 commented on July 21, 2024

With apologies for multiple open tickets. Is there a reason this is still open? (I.e. for my purposes it's resolved, not sure how this got re-opened.)

from austin.

cemerick avatar cemerick commented on July 21, 2024

Yeah, I'd like to keep it open until I have a chance to understand the document.write issue, starting with @johnwalker's theory.

from austin.

johnwalker avatar johnwalker commented on July 21, 2024
(def n (.getElementsByTagName js/document "iframe"))
(.remove (aget n 0))

I was off. Removing the iframe is where the problem starts.

from austin.

cemerick avatar cemerick commented on July 21, 2024

Confirmed @johnwalker's diagnosis. Thanks!

from austin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.