Jump to content

Trevor Hinterland

Resident
  • Posts

    31
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks for the suggestions and trying. I've checked all the things you mentioned many times over so will need to consider my next step. Looking through comments on the net in other forums there seem to be quite a few frustrations with the way IE handles or doesn't handle append.Child including a few with almost exactly the same problem. I haven't actually found any solutions from those though so maybe I will check out the microsoft Internet explorer support forums. That should be fun. Thanks again.
  2. You were right about the style keyword. That part now works without the style ! But i still don't get the response or rather I get an undefined response. Here is the firefox version.... <html> <head> <script src="http://sim9247.agni.lindenlab.com:12046/cap/51d35f89-3679-b847-4973-68487ba4065a/?testing123"></script> <script> function show() { document.testform.output.value=reply; } function sendrequest() { var input=document.testform.input.value; var new_scr=document.createElement('script'); new_scr.src="http://sim9247.agni.lindenlab.com:12046/cap/51d35f89-3679-b847-4973-68487ba4065a/?"+input; document.getElementsByTagName('head')[0].appendChild(new_scr); } </script> </head> <body> <BR> <H2>Server Test</H2> <BR> <form NAME="testform"> <INPUT TYPE="TEXT" NAME="input"> <INPUT TYPE="button" VALUE="Send to server" onClick="sendrequest()"> <INPUT TYPE="button" VALUE="show variable" onClick="show()"> <INPUT TYPE="TEXT" NAME="output" VALUE="output" SIZE=50> Test </body> </html> reply is the variable I am sending back in the response. The only difference in the IE version is the all in the dom ie document.all.etc Try it in firefox and you will see. Enter a string in the first box and click the show variable to get back what you sent. (I'm just sending back what was sent for now until I (or someone else:) can get it to work)
  3. I don't think I have a problem identifying where it is failing with functions as each step that I've tested works fine by itself. All the outputs steps are fine becuase having secondlife open at the same time my prim receives and shows the message and then tells me that it has sent the response. The response itself is very simple. Just a variable assignment replyvar='hello world'. As well as my prim telling me it's being sent I also know that it gets to the target becuase as I said.. It works in Firefox and Chrome. On the client side in my webpage there are no functions that instantly read out the variable. The only function I have is a single line assignment that puts the value into an output textbox when I trigger it from an onClick event. I know there is nothing wrong with the function or the assignment becuase I've tested that the button triggers the function and that a teststring instead of the variable gets to the output textbox. function show() { document.all.testform.output.value=replyvar; } The only thing I'm unsure of is the tagging on of the new src to the original for which i use.. function sendrequest() { var input=document.all.testform.style.input.value; var new_scr=document.createElement('script'); new_scr.src="http://my-long-prim-address/?"+input; document.getElementsByTagName('head')[0].appendChild(new_scr); } As there are necessarily two script tags.. The first with the prim address and the second with the functions (becuase i t doesn't allow me to put any functions in the first script if the request is to be sent0 I'm wondering if the append is being appended to the wrong place. Maybe I should delete the first script tag after I've sent the sendrequest ? oooh Maybe I should be appending to 'script' ? I'm totally stuck now.
  4. In the firefox and chrome scripts that work I do nothing with the initial response but include a button and text field in the html. The button triggers a function with an onClick=readvariable() that sets the text field to the variable I am testing whenever I press it. I realise the doms are slightly differerent for those browsers so I used a document.write in the function as well but it stll didn't work. ie: I get an empty textbox. I know I am setting the textbox field correctly because I tried it with a fixed string rather than the variable i was trying to read from the returned response. Thanks for helping.
  5. Ok - I'm a little reluctant to post this here becuase I know I've now reached the point where I'm talking javascript rather than LSL. In my defence, when I started this thread the LSL and Javascript difficulties overlapped and as two sides of the same coin it was necessary to start here not knowing just where the solution lay. Also.. having concluded in the previous posts that the problem was fully solved I'm posting here again becuase I've since discovered that that isn't quite the case and i don't want to mislead anyone. So if anyone feels like nagging me for posting in the wrong place (but to be fair the people in this section seem much more reasonable and understanding than elsewhere) then my main excuse is that I'm just updating the previous error that this is a final solution that works becuase at the moment it doesn't. Using the previously mentioned methods I have now got to the point where I can set a variable in my external javascript page,send it via a script tag to my in world prim and then via an http response send back whatever javascript response I want to the external webpage via the script tag from whence it came. Doing this I can do some calculations in the prim dependent on the data in the query string. This all works well but I've since found for some reason it doesn't work in Internet explorer. It works in firefox, and chrome. I haven't tried any others yet becuase obviously making it work in explorer is a must. I can't see any reason whatsoever why it is not working. The prim receives the request and sends out the response. In the very simplest of cases.. (the ones I am using at the moment I am just sending out a variable assignement as a string... eg var variable="something" then reading the variable in the webpage javascript to see if it has been updated. It doesn't seem to be a dom issue becuase I've tried reading the updated variable without using textboxes etc where the doms are different. Just using document.write(variable). As I said.. It works in Firefox and Chrome. Does anyone know if the same origin policy excludes scripts from doing this in Internet Explorer. I know Internet Explorer like to be different. Perhaps I should ask. Has anyone ever done this in Explorer and got it to work ? Thanks for any help.
  6. It's probably not this but it can happen. Has the object that you are rezzing it from been rotated ? If it has and you are using the rezzing object as a reference for the rotation then I believe it might be rotated relative to the rezzer. In that case you either need to keep the rezzer at zero rotation or llget the rotation of the rezzer and pass it as the rotation parameter when rezzing the object being rezzed.
  7. My guess is that it's rotating to the zero rotation of the root prim. (The prim you linked to the object last). Having to correct rotation errors with scripts can get enormously confusing especially if you do additional rotations once it's rezzed so the best way is to make sure you keep your prims (unrotated when rezzed) unless absolutely necessary. If you don't want to unlink your object to change the root prim you can always rezz another prim (without rotating it) and link it on to the object as the last prim. I know this solution won't work for everything, especially the more complicated structures with multiple rotations and offsets but you could try this first.
  8. Apologies. It works fully now and you were right. It does accept query strings in the script tag too ! That's what I was doing wrong. I forgot I was testing for a query string when I wasn't using one. As soon as I tried the query string in the script tag it worked fine so ALL problems solved now as long as dynamically updating the script tag doesn't mess things up which I don't think it will. Thanks again.
  9. Well - I will certainly use Teacup as well becuase I know I would never in a lifetime have attempted it or could have achieved it. The real problem is you shouldn't have replied becuase it makes it easier for me to ask another question like why for example is my variable not being set ! What I did was set a variable in the response string like "thisvar='Hello world' " and then in the javascript just use document.write(thisvar); Even with the script tags it comes out as document.write(this var). Probably something wrong with my double quotes ?
  10. Well I think it's time I stopped asking questions and started experimenting. Thank you again for all the suggestions. I feel confident enough know to sort this out. In fact, i think the solution comes down to what you said in some of your earlier posts, which I didn't really understand at the time but now it all makes sense. Like wrapping the javascript in a variable. In fact, know that I realise just how open the server/client interface it is to pass information back and forth using the script tags it will be a lot easier. Looking at your teacup code and accessories has been enormously helpful and I've learnt a lot of things from this. In a sort of ironic way I think there is too much in there for what I need to do but what i've found out in the processs has been extremely valuable. What amazes me the most is thinking how long I could have spend trying to use jquery get or a psp proxy when a script tag provides the solution. And even more amazing is why there is so much info about the same domain rule when doing cross domain stuff when a tag seems to bypass it all. Since I don't really need to create javascript on the server side, although I can see lots of potential uses for it, (non the least media on a prim) passing data across to the file handler isn't really needed in this instance so what I've just tried is to use the simple hello world example that I started with and it does indeed receive data from the script tags. If I try your suggestion of wrapping the javascript response in a variable (which i think means putting it all in one long string) then I'll finally have a solution. :matte-motes-smile:
  11. Thanks for the info. I can see quite clearly how you are parsing the string data and it helps to see this here but what I'm not sure of is what method sends the string when it comes from the script tag. You say that if the 'the file' doesn't handle post (such as I'm using with script tags) it doesn't matter so do I conclude (just to be certain) that data requested from script tags uses the post method ? I only ask this becuase you have the query string check in there and it appears that I can't use that in script tags. (Sorry if it's a stupid question but you have to realise my only familiarity with post and get is in the method = section of a form). It's new (and quite revealing) that script tags might use the same protocol. The other thing is (and I think I have a solution here) as I'm using script tags and so can't use query string can I tag a non existant file name on the end of the address and use that as my variable. for example: address/pretendvariable1.pv and then take action in my script depending on what predendvariable I find when I parse the string ? (ie: not as a variable - just a string name) whose representations I allready know in the server. If this is possible then I think the solution will be finally found !! Yey
  12. It works now and I have to say I'm pretty amazed !!! Thank you for sharing your scripts and all the help you've given. Only difficulty now is getting it to do what I wanted to do in the very beginning which was to pass in data, (assign or read some variable values for example) and then send them back when I need them. Apart form using Jquery as I was trying to do before which as you know would have been the easiest thing to do had I been able to get the response back into the script this new method has me stuck again because now I'm requesting a file rather than sending a query-string holding data. As you know before I was getting the values in ok but not getting the response back in to the outside page. Now although I can (thanks to your solution) inject the javascript into the page there seems to be a difficulty passing in data. I realise I can maybe dynamically via javascript update the script tags to ask for another file but now we are dealing with files rather than a query string that before I could have read and done whatever action I needed too. Is it possible to pass in data at the same time, and if possible keep the same script tag to avoid having to dynamically replace it ? I'm not sure how I would grab this information in the server because I'm not sure what method is being used in the http in. I'm not adding a query string (although there seems to be some query string checks in there that I don't understand) so how do I identify any info I pass in other than the file name. ?
  13. No problem getting the teacup and tea stuff to work for moap thanks to the step by step instructions. Trying to get a response from my external webpage (or just by typing in the browser address bar) has been another matter. When I looked at the server script to try and work out the script flow from input to output I got stuck in the server at. the http_request handler (see below) becuase I couldn't see any code for dealing with the last element GET. (the one I'm using if I send a request as a query string) I'm assuming (probably incorrectly) that (4 & vIntMth) is the same as if (vIntMth ==4) ? I've not seen comparisons made this way before so apologies for appearing stupid but I feel if i could just get past this point the rest would slot into place. I only mention this becuase there doesn't appear to be a check (3 & vintMth). ie: the GET element in the list unless I've got this totally back to front. In short.. How do I reference a file from my external web page ? I've tested that the url I'm using is the correct one for the prim and confirmed that it is and also that the server receives the request, which it does, but I can't get any file back. I note in that section of code a link message should pass the parameters to the tea script and eventually send out the response but I can't see where it's going wrong. In short - what format should I be using to reference the file I need ? Do I just tag it on to the url as a query string eg: /?page1.tsp and how is the server detecting my querystring when there doesn't appear to be a test for it ? Is this the problem ? ahhh - Just realised - It's a script tag so it's not an http get anyway and it wasn't even the javascript example ! Stupid me - I was still thinking about the http get. sorry ! In that case do i just place the file name on the end of the url as usual ? eg: prim url/page1.js http_request( key vKeySrc, string vStrMth, string vStrBdy ){ integer vIntMth = llListFindList( [URL_REQUEST_DENIED, URL_REQUEST_GRANTED, "POST", "GET"], [vStrMth] ); if (4 & vIntMth){ //-- trap unused here, check we hasve a valid non root file name on the next line }else if (2 & vIntMth){ if (vStrMth = llUnescapeURL( llDeleteSubString( llGetHTTPHeader( vKeySrc, "x-path-info" ), 0, 0 ) )){ llMessageLinked( LINK_SET, 418, vStrMth + "?" + llGetHTTPHeader( vKeySrc, "x-query-string" ) + "#ip=" + llGetHTTPHeader( vKeySrc, "x-remote-ip" ) + "&" + vStrBdy, vKeySrc ); if (gLstPndTim == []){ llSetTimerEvent( 3.0 ); } gLstPndKey += [vKeySrc]; gLstPndTim += [llGetUnixTime() + 20]; }//-- can handle root requests here later if we want Thanks again for all the help. I can see that this code has real potential and I'd really love to be able to use it. For now I'll go get a cup of tea
  14. Well now this is getting really interesting. Thanks for the suggestion but just a quick question or two. (Well sorry it's turned out to be more than I expected) Can any javascript go into those files and is there a size limit ? Can I use buttons, text boxes, variables etc. I only ask becuase I wasn't planning on doing prim - webpage communication in this way. What one is familiar with always seems the best way so it seems strange at the moment to put javascript in a notecard although I have to admit very ingenious. Lots more questions come to mind but one is key like is it possible to get the javascript in the notecard to communicate with LSL ? That is after all the main reason for wanting the external web page to communicate with the in world prim in the first place. If that's not possible then I would have no reason not to put the javascript in the external webpage in the first place. Thanks again for the suggestion. I will definately try this once I have read it through in more detail.
  15. Am I correct in concluding that your solution works for serving webpages to media on a prim but not as an httpresponse to a get query string on an external website ? As I've mentioned, I would like to do the later. To load the llhttpresponse (in any way it can be constructed) back into the external out of world page that made the initial request. The key point as I've mentioned is to get the response back (either to within the initiating page) or at least back to the browser (not the viewer (or the browser in a viewer)) as an external out of world webpage.
×
×
  • Create New...