Pretty Basic but need help

Post your HTML code (as attachments) here and a description of what that scene does.
wireless
Senior Member
Senior Member
Posts: 210
Joined: Wed Mar 24, 2004 10:44 am
Location: East Tennessee
Contact:

Pretty Basic but need help

Postby wireless » Thu Dec 17, 2009 3:48 pm

I'm sure this is pretty basic but HTML is new to me. I'm using frames and this frame contains the document lighting1.html which is a control for all of my lights. When issuing a command using:

<a href="./MLCMD?MLHSPlugin|ToggleDevice:q1" target="lighting1"><b><img src="lightbulb-empty.png" width="68" height="68" alt="" border="0"></b></a>{{MLHSPlugin_q1_name}} {{MLHSPlugin_q1}}<br>

The command works but opens a new blank window. I have been able to restrict the new window opening to the same frame the command is issued, but what I would like to happen is for the original html document to reload in the frame after the command with the current status of all the devices.

Any ideas from you masters of all things web?

wnl
Member
Member
Posts: 65
Joined: Mon Oct 26, 2009 10:19 pm
Contact:

Re: Pretty Basic but need help

Postby wnl » Wed Dec 23, 2009 11:43 pm

I don't think you can do that with just an <a href="...">. The problem is that the browser is expecting that link to provide a new page. Since it doesn't get anything displayable back from the MLCMD then it will display a blank page/window/frame. You can ensure that the new page shows up in the same frame with target="_self" but I think it will still end up blank.

Probably the only way to do this is to write a javascript function that sends the MLCMD request, let's call it doCommand. Then you would do something like this:

<a onclick="doCommand('MLHSPlugin|ToggleDevice:q1')" href="lighting1.html" target="_self">

Then you'd have to include the doCommand js function either in the page head or in a separately loaded file. I've seen something like this in the iPhone web pages.

wireless
Senior Member
Senior Member
Posts: 210
Joined: Wed Mar 24, 2004 10:44 am
Location: East Tennessee
Contact:

Re: Pretty Basic but need help

Postby wireless » Thu Dec 24, 2009 3:50 pm

Thanks, I figured it out <a href="./MLCMD?MLHSPlugin|ToggleDevice:q1" OnClick=window.location.reload()"> Worked like a charm.


Return to “MLServer HTML Sharing”

Who is online

Users browsing this forum: No registered users and 1 guest