what's the html support like?

Apr 24, 2008 at 6:05pm

what's the html support like?

i’ve seen several mentions in the news postings of some sort of html integration, allowing max patches to be embedded in web pages… and i’ve also seen the integrated web browser in max 5, but i’m still unclear as to what exactly its capable of.
can this embedding be used in other browsers? how does that work (maybe java applets..)?
is there an ability to embed html in max patches as well? i looked a bit at the example that features a browser, but when i switched it into patching mode, the object that had been the browser didn’t respond to clicking or editing….

#37189
Apr 24, 2008 at 6:42pm

Max inside browsers has never been a feature of Max 5, I don’t know where you heard that.

There is a new object, jweb, which lets you host web pages from within Max. There is documentation on jweb built into Max 5.

#128257
Apr 24, 2008 at 6:46pm

Quote: Chris Muir wrote on Thu, 24 April 2008 14:42
—————————————————-
> Max inside browsers has never been a feature of Max 5, I don’t know where you heard that.

there was some talk of it somewhere in the announcement thread
http://www.cycling74.com/forums/index.php?t=msg&th=32739&prevloaded=1&rid=4698&S=1bb7d6836b7f80d8bec6f60f9b99713b&start=120
i’m not sure if any of that was official though. i’d guess that it wasn’t.

> There is a new object, jweb, which lets you host web pages from within Max. There is documentation on jweb built into Max 5.

i haven’t had as much time to go through the docs as i’d like, but i’ll check it out.

thanks.

#128258
Apr 24, 2008 at 7:36pm

For Max in a browser, are you thinking of Lily? http://www.lilyapp.org
That’s not Max, but very similar.

There have been a few discussions in recent months of embedding a webserver inside of Max, so you can use a browser to communicate with your patches. Here’s one way: http://www.loadbang.net/space/Software/net.loadbang.web

There were also some examples of using Max to serve up web pages to communicate with the iPhone, look for the aka objects iPhone examples.

Not yet sure what’s possible with the embedded browser in Max 5…

#128259
Apr 24, 2008 at 7:52pm

i’m guessing that i got mixed up about what was official feature description and what was requests on the forum..

#128260
Apr 24, 2008 at 7:54pm

I thought that Lily uses JSON as a file format, too, so there could be some interesting interaction between Lily and Max.

Brad

#128261
Apr 24, 2008 at 8:17pm

Try the attached patch. This should give you a basic sense of the types of things you could do with an embedded browser…

AB

#128262
Apr 24, 2008 at 9:22pm

very interesting…

i cant find any documentation that shows what we can do inside a page loaded into a jweb object to either handle messages or to send messages.

is there any available now?

or are they coming soon?

p.s. i had to change the message to ‘readfile htmltomax.html’ for it to work for me on windows.

#128263
Apr 24, 2008 at 10:36pm

Quote: mdk wrote on Thu, 24 April 2008 17:22
—————————————————-

> p.s. i had to change the message to ‘readfile htmltomax.html’ for it to work for me on windows.
—————————————————-

Same here on OSX 10.5.2. Not sure if that is working as intended or a bug since I haven’t really had time to check that object out yet.

#128264
Apr 24, 2008 at 10:42pm

Quote: Roth wrote on Thu, 24 April 2008 18:36
—————————————————-
> Quote: mdk wrote on Thu, 24 April 2008 17:22
> —————————————————-
>
> > p.s. i had to change the message to ‘readfile htmltomax.html’ for it to work for me on windows.
> —————————————————-
>
> Same here on OSX 10.5.2. Not sure if that is working as intended or a bug since I haven’t really had time to check that object out yet.
>
—————————————————-
P.S. Just tried reopening and made another discovery. Before clicking anything I went into edit mode and a current URL was displayed and it was a file:/// URL on your computer Andrew. My guess this has something to do with the issue? I thought that maybe since Max saw the file as having the same name, it did not bother to try to update the URL with the local copy so I made a new file called “htmltomaxB.html” and when I sent [jweb] a “url htmltomaxB.html” nothing changed–in edit mode the URL was still the file:/// url on Andrew’s computer. Again, making a “readfile htmltomaxB.html” worked fine. I’m not sure what all that means, but hopefully it is helpful if this is indeed a bug.

#128265
Apr 24, 2008 at 10:43pm

On my windows machine I dragged the html file into the jweb object in the patch. Haven’t tried on my Mac – I expect it will work the same way.

Brad

#128266
Apr 24, 2008 at 10:49pm

Sorry, that was bad patching on my part. “readfile” is the way to go in this case. You can avoid all of this nonsense by just dragging and dropping HTML files from the Finder or File Browser onto jweb. It shows the file from my computer because jweb stores the URL as an attribute. Sorry to distract you with my imprecise patching.

AB

#128267
Apr 25, 2008 at 3:05pm

support is good on the mac. Attached is a patch that turns jweb into a virtual desktop using some javascript libraries.

i’ve got ajax to work, the canvas tag, flash …
you can also open processing applets.

it took me a long time to find the jweb object – shouldn’t cycling give it a bit more prominence in max 5? for example at least include it in the whats new section.

is there somewhere that lists the ways of getting information out of web pages into max or is it one of those mysterious objects that have lots of undocumented features that only become apparent as the months go by?

one of the other features I was looking forward to exploring in Max 5 was the database. Is this an object I just haven’t come across or is it purely for backend Max 5 use?

pelado

#128268
Apr 25, 2008 at 3:17pm

Quote: pelado wrote on Fri, 25 April 2008 17:05
—————————————————-
> it took me a long time to find the jweb object – shouldn’t cycling give it a bit more prominence in max 5? for example at least include it in the whats new section.

> is there somewhere that lists the ways of getting information out of web pages into max or is it one of those mysterious objects that have lots of undocumented features that only become apparent as the months go by?
>
> one of the other features I was looking forward to exploring in Max 5 was the database. Is this an object I just haven’t come across or is it purely for backend Max 5 use?
>
> pelado
—————————————————-

thats exactly what i was thinking. jweb also doesnt appear when doing autocomplete in a new object box.

what im interested in is how to get data in to jweb without loading a file / url. can we call javascript functions inside? can we create pages dynamically by passing in html?

are using anchor tags the only way to trigger messages from inside?

I was also really looking forward to the database access. If we can get some reasonable amount of control over jweb and database access there is a whole new world of applications waiting to be built.

#128269
Apr 25, 2008 at 5:30pm

my appologies – my last post contained a version including jweb that doesn’t work correctly. Is there a cache system in use with the browser? because I’m sure that the patch was working ok when I sent it. If there is a cache then can it be cleared using a message to jweb?

I’ve attached the file again to this post. Hopefully it will work correctly now.

pelado

#128270
Apr 27, 2008 at 9:31pm

I like the idea of being able to pass variables into a webpage with jwep. I have been trying to encode text into a fancy URL, similar to how google does this: http://www.google.com/search?q=topicname

I added url at the beginning and used atoi and itoa to put the two strings together without spaces so that I had numeric values, then converted into a spacebarless string: 117 114 108 32 104 116 116 112 58 47 47 119 119 119 46 103 111 111 103 108 101 46 99 111 109 47 115 101 97 114 99 104 63 113 61 116 111 112 105 99 110 97 109 101 = url http://www.google.com/search?q=topicname (that is after the numbers are sent to the itoa object.)

At the very least, that is one way a search string can be sent into jwep, but it only works with google. I want to be able to fill in a textbox or textarea in my own web pages.

Any suggestions?

#128271
Apr 27, 2008 at 10:06pm

I’ve been looking into parsing variables in my webpages from the URL sent into jweb. Does anyone else think this will work?

#128272
Apr 28, 2008 at 1:43am

i found out that you can change the title of your website from within with javascript

document.title = “bla bla”;

jweb will pump out the new title
this could be used to trigger some event in max.

but the other way arround is breakin my head..
i cant find a way to get javascript commands into jweb. in a usual browser you can just type “javascript:dosomething();” and it will call the function, but the jweb object doesnt seem to do that.

is there a backslash-quote kinda trick or is it just not possible?

#128273
Apr 28, 2008 at 2:00am

@jgagich:
try the sprintf object to format strings

(message) mySearch
|
(object) sprintf url http://www.yoururl.com/?q=%s
|
(print)

this should print> url http://www.yoururl.com/?q=mySearch

then you could use php to $_GET['q'] and echo it into your textfield.

#128274
Apr 28, 2008 at 3:08am

The sprintf object works well, thanks! Also, I was able to use the $_GET['variable'] PHP function to successfully pass a variable from max into my webpage. I am only beginning to imagine the possibilities… Thanks for the help!

#128275
Apr 28, 2008 at 4:54am

I played around with the echo $_PHP['variable'] idea.

I have attached an example and also uploaded a page to my domain for testing purposes. I do so only because I want a better solution to manipulate web pages in MAX and I am hoping this inspires you. Please play around with this, but remember to post ideas bc I am out.

Thanks!

#128276
Apr 29, 2008 at 6:40am

jmg460 schrieb:
> I played around with the echo $_PHP['variable'] idea.
>
> I have attached an example and also uploaded a page to my domain for
> testing purposes.

You named the patch jweb.maxpat. Think about it, this is asking for
trouble…
Its not a good idea to name a patch the same as an official external,
especially if this patch is loading that external, it might want to load
itself recursively… (There is some prevention built into Max, but
still…)

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#128277
Apr 29, 2008 at 6:05pm

> You named the patch jweb.maxpat. Think about it, this is asking for
> trouble…

its still a nice example jgagich. :)

i like the way you get data from jweb to max. better then my title hack ;)

if somebody could figure out a way getting javascript funtioncalls to jweb without refreshing that would be awsome and close the loop.

#128278
Apr 29, 2008 at 6:23pm

Quote: NooitAf wrote on Tue, 29 April 2008 11:05
—————————————————-
>
> i like the way you get data from jweb to max. better then my title hack ;)

Yeah, that’s awesome. I didn’t see that feature documented anywhere…

> if somebody could figure out a way getting javascript funtioncalls to jweb without refreshing that would be awsome and close the loop.

I was trying to figure this out. Do you guys know about bookmarklets? Try this:

go to http://google.com

then copy this into your browser address bar and hit enter:

javascript:(function(){document.body.style.backgroundColor=’yellow’}())

This runs javascript on the current page without refreshing. People sometimes bookmark chunks of javascript functionality like that, hence the term bookmarklet. It is not the most elegant solution, but it would close the loop for jweb. I’m sure an abstraction could make this technique easy to use.

Alas it doesn’t work with jweb, but I would think webkit supports it…

If we can figure out how to make this work, jweb will be an amazingly powerful component to use in Max patches. I hope there is a way!

#128279
Apr 29, 2008 at 10:40pm

Have you seen the the patch I uploaded here:

http://www.cycling74.com/forums/index.php?t=msg&rid=0&S=d6eb4231af524292f49e24d55774a06f&th=33076&goto=138659#msg_138912

it has an example of using javascript to load sections of pages without need
to refresh the whole page. there is also an example of an XMLHttp request
where you can dynamically load pages from a server. From what I have seen
jweb provides access to all the latest technologies of web 2.0. The
possibilities are indeed astonishing!

Unfortunately, I am no programming wizard, but I have been looking at jquery
and found that it and many other javascript libraries and their plugins work
well in jweb. If you haven’t seen them, I suggest you check them out (there
are some links in the patch i referenced).

I haven’t found out how to get data into jweb yet, other than the exampe
posted above by jmg460, but surely there must be ways of achieving it with
javascript? Has anyone tried sending messages to the named jweb object?

I think this is one of the most explosive objects that max 5 has introduced.
If only I could work out how to get a json file to be downloaded from a
site and opened as a max patch on your computer… Ha, ha! there’s another
security worry :)

pelado

> > if somebody could figure out a way getting javascript funtioncalls to
> jweb without refreshing that would be awsome and close the loop.
>
> I was trying to figure this out. Do you guys know about bookmarklets? Try
> this:
>
> go to http://google.com
>
> then copy this into your browser address bar and hit enter:
>
> javascript:(function(){document.body.style.backgroundColor=’yellow’}())
>
> This runs javascript on the current page without refreshing. People
> sometimes bookmark chunks of javascript functionality like that, hence the
> term bookmarklet. It is not the most elegant solution, but it would close
> the loop for jweb. I’m sure an abstraction could make this technique easy to
> use.
>
> Alas it doesn’t work with jweb, but I would think webkit supports it…
>
> If we can figure out how to make this work, jweb will be an amazingly
> powerful component to use in Max patches. I hope there is a way!
> –
> Adam Murray

#128280
Apr 29, 2008 at 11:34pm

Quote: pelado wrote on Tue, 29 April 2008 15:40
—————————————————-
> Have you seen the the patch I uploaded here:
> http://www.cycling74.com/forums/index.php?t=msg&rid=0&S=d6eb4231af524292f49e24d55774a06f&th=33076&goto=138659#msg_138912

Somehow I missed that. Very cool.

> Unfortunately, I am no programming wizard, but I have been looking at jquery
> and found that it and many other javascript libraries and their plugins work
> well in jweb. If you haven’t seen them, I suggest you check them out (there
> are some links in the patch i referenced).

jquery and YUI are great. I use them every day. I have also in the past used prototype, scriptaculous, and dojo to name a few of the better ones. There is also this impressive piece of work but it seems a bit buggy: http://qooxdoo.org/ (check out the Showcase demo).

> I haven’t found out how to get data into jweb yet, other than the exampe
> posted above by jmg460, but surely there must be ways of achieving it with
> javascript?

So that’s what my last post was about. I’m in the same boat: I cannot find a way to send a message to jweb from Max to trigger javascript calls without reloading. That’s the last missing piece before an amazing meld of modern web technologies and Max. The possibilities are ridiculous…

I think we may need to wait for C74 to provide a hook to make a javascript call to jweb (you’ll give us that hook eventually? right? right???). It would be fantastic if someone found a hack in the meantime but I am out of ideas.

#128281
Apr 30, 2008 at 1:22am

Stefan,

Thank you for the naming tip. In my haste and excitement, I didn’t give any thought to the name of my patch–all I cared for was that it worked. However, it does seem like a good practice to not name the patch the same as a bonified object. I will keep that in mind.

jgagich

#128282
May 2, 2008 at 8:14am

jmg460 schrieb:
> Stefan,
>
> Thank you for the naming tip.

I forgot to mention, that the patch itself was great. You web wizards
will push Max even further into the future. I wonder if I should make
Max to my standard browser now, I just need to find a way to get my
immense bookmark list somehow in…
Will jweb accept the standard plug-ins as well? Flash comes to mind first…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#128283
May 2, 2008 at 11:48am

well it seems to do everything that could happen in any safari window, but there is one thing….

NO POPUPS..

well usually thats a good thing .. but in this case it should be a kind of irritating. also if the window size gets changed by javascript the jweb patch just goes wild ;)
alerts arent possible either, so i wouldnt recommend jweb as a standart browser but you could give it a try ;)

#128284
May 2, 2008 at 12:43pm

#128285
May 2, 2008 at 4:53pm

There are indeed popups

#128286
May 2, 2008 at 5:21pm

I just want to chime in for a moment to explain a few things about jweb.

First, jweb was developed first and foremost as a host object for our inline documentation. We’ve made the object available for end users, as well, but it wasn’t envisioned as a full-featured web browser. Manuel Poletti’s example “WeBrother” takes the object pretty far, but there are obviously things which many users would like to do which aren’t available (yet), such as having programmatic access to the page contents (which you can probably do with a combination of clever JavaScripting and the “maxmessage” feature (described below) — I’ll give it a shot), or some more exotic possibilites for integrating the jweb object with the Max patcher. We’ve thought about a lot of this stuff, but didn’t have a chance to fully flesh it out before release. So, it’s something to look forward to.

Additionally, jweb on Macintosh has a number of idiosyncracies which come from our use of Apple’s WebKit. We’ve gotten around a number of things, but some of the weirdness with menubar commands, scroll bars and the like are simply the consequence of embedding a key- and mouse-greedy WebView inside of an unrelated application. We continue to attempt to work around those problems.

That said, jweb has a couple of interesting features for the power user. You can create anchors using the ‘max’ and ‘maxmessage’ protocols to get data from a web page into the ‘max’ object and your patcher, respectively, like this:


Hide the menubar

or


Send the result of ; max getruntime to a receive object named foo

The maxmessage protocol sends the formatted message (/s are atom separators) out of the object’s outlet, prepended by the word “maxmessage”.


Click to find out what I really like

would trigger ‘maxmessage i really “like celery”‘ (without the double quotes — I just include them to make clear that it’s a single symbol).

So, keep your eyes open for future improvements to jweb in coming releases. To be honest, it will probably be a few point releases from now before there are any major changes — we have some other exciting stuff we’re working on, as well — but it should be worth the wait.

Jeremy

#128287
May 2, 2008 at 6:40pm

On 2 May 2008, at 18:21, Jeremy Bernstein wrote:

> That said, jweb has a couple of interesting features for the power
> user. You can create anchors using the ‘max’ and ‘maxmessage’
> protocols to get data from a web page into the ‘max’ object and your
> patcher, respectively, like this:

Don’t forget that, for maximum integrated live HTML action, the web
pages can be served from the local machine’s Max search path (or any
other machine running Max), and can include JSPs with dynamic content
and parameters generated by Max itself. You’ll need the web server
package:

http://www.loadbang.net/space/Software/net.loadbang.web

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom
http://www.last.fm/music/cassiel
http://www.reverbnation.com/cassiel
http://www.linkedin.com/in/cassiel
http://www.loadbang.net

#128288
May 2, 2008 at 7:36pm

Wow jweb is pretty cool. I can actually load Processing apps
in Max! I would definitely like to be able to pass data
back and forth. There is great potential here…

#128289
May 3, 2008 at 12:05am

Thanks for clearing this up Jeremy. I’m looking forward to seeing how the
jweb object unfolds. I’d love to see any tricks you can conjure up.
pelado

On Fri, May 2, 2008 at 7:21 PM, Jeremy Bernstein
wrote:

First, jweb was developed first and foremost as a host object for our inline
> documentation. We’ve made the object available for end users, as well, but
> it wasn’t envisioned as a full-featured web browser. Manuel Poletti’s
> example “WeBrother” takes the object pretty far, but there are obviously
> things which many users would like to do which aren’t available (yet), such
> as having programmatic access to the page contents (which you can probably
> do with a combination of clever JavaScripting and the “maxmessage” feature
> (described below) — I’ll give it a shot), or some more exotic possibilites
> for integrating the jweb object with the Max patcher. We’ve thought about a
> lot of this stuff, but didn’t have a chance to fully flesh it out before
> release. So, it’s something to look forward to.
>

#128290
Apr 20, 2009 at 7:44am

I’ve been browing this topic to see if I can find an asnwer to the problem I’m having, but alas…

I’m not trying to get any info into jweb, just out of it. A website has been made (not by me, but specificly for my patch) using a google maps map. There are clickable points on the map, clicking one of these points will change the title of the website. So the site doesn’t actually reload, only the title changes. The title is a simple integer I use to look up variables in a table

Somehow, the jweb object doesn’t update the title on windows. It works like a charm on Mac and every other site seems to work on windows. Can anyone tell me if the problem is in jweb, windows, or the website, and is there simple solution (like an activeX control package)?

here’s the subpatch

– Pasted Max Patch, click to expand. –
#128291
Apr 21, 2009 at 5:32am
daniel@specialpatrolgroup.nl wrote on Mon, 20 April 2009 00:44
I’m not trying to get any info into jweb, just out of it. … There are clickable points on the map, clicking one of these points will change the title of the website.

Somehow, the jweb object doesn’t update the title on windows.

I don’t know why it’s not working on Windows.

Perhaps there is an exception causing things to fail on Windows. I would suggest you ask the website developer to try wrapping the code that handles mouse clicks in a block like this:

try {
  // ... existing code ...
}
catch(exception) {
   alert(exception)
}

And see if that sheds any light on the matter.

If there is no exception and it seems like setting the title is simply not working, then change the relevant line of code in the rhMaps.js file:

document.title = code;

to this alternative way of sending a message to Max:

location.href = 'maxmessage:' + code;
#128292
Apr 4, 2011 at 9:31pm

Anyone had any luck with this? Would like to see Andrew Bensons patches on what can be done with a web browser… I’m trying to get a midi device to control google maps (or somehow connect to google maps using incoming midi data).
Any hints on this would be great!
J

#128293

You must be logged in to reply to this topic.