Page 1 of 1

problem with <object></object>

Posted: Mon May 16, 2011 8:04 am
by Isaac
I'm writing a very easy to use comment box for my friend's site. It should allow my friend to make as many comment boxes as he wants by pasting a little html into the body of his html.

A cool feature: To make a new comment box he just has to change a little text, "commentbox1", to a different name and the cgi file figures everything out on its own.

I have an example running:
[link removed]

It seems that the <object> tag does not always work in Internet Explorer.
Currently I'm trying to make a comment box system that requires very little user-side code.

This is how the comments are displayed. The "?boxname=commentbox1" is how the cgi file knows what dictionary key to reference. This way the same cgi file and database text file can be used for all the comment boxes on a website.

Code: Select all

<div style="margin: 0 auto; width:100%; height:200px;"><object type="text/html" data="commentsystem.cgi?boxname=commentbox1" style="width:100%; height:100%; margin:1%;"></object></div>
This next part works with out any problem. It's what's used to add a new comment.

Code: Select all

<form action="commentsystem.cgi" method="get">
<input type="hidden" value="commentbox1" name="boxname">
<input type="hidden" value="http://websitedomain/pagewherecommenttookplace.html" name="pagename">
Name:<input type="text" name="username" size="10" value="anonymous" maxlength="20"><font size="1">(max chars 20)</font><br/><br />

Post a comment:<br/>
<textarea name="cm" maxlength="200"></textarea><br />
<font size="1">(max chars 200)</font><br />
<input type="submit" value="Submit" />



Re: problem with <object></object>

Posted: Mon May 16, 2011 10:21 am
by Sirius
Works in IE9... but then again.

Re: problem with <object></object>

Posted: Mon May 16, 2011 10:32 am
by Isaac
That's good.

I was thinking of having the CGI file write directly to the html file where the comment box's div layer is. That could be easier to implement.

Just a concept:

1 someone posts a comment from html file

2 python start

3 add new comment:

start=infile.find("<comments go here>")
end=infile.find("</commments>")

4 ...write commments for this page between "start" and "end", when a new comment is made..
5 /python
6 redirect user to same page

Re: problem with <object></object>

Posted: Mon May 16, 2011 3:49 pm
by Jeff250
I've never seen the object tag used like this, but it sounds like it's valid. This is something one would typically use an iframe tag for, but...
Isaac wrote:I was thinking of having the CGI file write directly to the html file where the comment box's div layer is. That could be easier to implement.
This. If I understand you correctly. Make your frontpage entirely a *.cgi page and avoid the iframe stuff all together to pull in the cgi bits. Use <div style="overflow:scroll">foo</div> (or overflow:auto) over the comments to duplicate the scroll bar if that's important.

edit: Also, the usual caveats of allowing your users to post arbitrary html apply here.

Re: problem with <object></object>

Posted: Tue May 17, 2011 1:13 pm
by fliptw
One would say this could be backed by a database.

Re: problem with <object></object>

Posted: Tue May 17, 2011 1:44 pm
by Isaac
Jeff250 wrote:I've never seen the object tag used like this, but it sounds like it's valid. This is something one would typically use an iframe tag for, but...
Isaac wrote:I was thinking of having the CGI file write directly to the html file where the comment box's div layer is. That could be easier to implement.
This. If I understand you correctly. Make your frontpage entirely a *.cgi page and avoid the iframe stuff all together to pull in the cgi bits. Use <div style="overflow:scroll">foo</div> (or overflow:auto) over the comments to duplicate the scroll bar if that's important.

edit: Also, the usual caveats of allowing your users to post arbitrary html apply here.

Yeah, I agree. I had html <> brackets being replaced by empty strings "". I ended up breaking that part of the code, but I've moved on and decided to learn javascript to pass data with out refreshing the page. I think I'll end up using jquery, like you've recommended, but I think it's worth learning the basics of javascript.

Re: problem with <object></object>

Posted: Tue May 17, 2011 2:23 pm
by Jeff250
Why do you need Javascript/jQuery here? Maybe there's a part of your plan I'm not grokking, but I think you're over-complicating things.

Re: problem with <object></object>

Posted: Tue May 17, 2011 3:17 pm
by Isaac
Jeff250 wrote:Why do you need Javascript/jQuery here? Maybe there's a part of your plan I'm not grokking, but I think you're over-complicating things.
I'm doing some experiments and there's a few goals I'm shooting for, all for fun. One of them is a simple chess game that runs from client A to server to client B, with out having to refresh the browser. Do I need Jquery? I don't think I do, but probably should learn more about it. I haven't started reading about what all it does yet. I will eventually.

Re: problem with <object></object>

Posted: Tue May 17, 2011 9:06 pm
by Jeff250
Oh I see--yeah, there are ways you could try to get around using Javascript in that case, but Javascript is definitely the cleaner route. I thought you were talking about for your comment system.

edit: Any by Javascript, I mean to include jQuery.