Jump to content

General Question For All.please Respond


shobhitjain
 Share

Recommended Posts

Hi to all Professionals hereWell after lot of search and Discussion ,A question raised in my mindIf you have to send a cross domain request ,Keeping in mind all security and issues WHAT is the first thing that comes up in your mind?Also knowing that Javascript and Ajax doesn't allow this .

Link to comment
Share on other sites

The point of the proxy is so that the AJAX script doesn't have to directly request the remote server, instead, it requests the proxy sitting on the local server to make the request, on its behalf, to the remote destination, and return the response. So instead of

AJAX script <-/-> Remote server

you have

AJAX script <---> server-side proxy <---> remote server

And since the server-side script doesn't have the domain restrictions on it, it can request files from anywhere.I don't quite understand what you mean by "toolbar", though.

Edited by Synook
Link to comment
Share on other sites

Thanks for telling ,but i don't need any proxy.If proxy is needed the work would have been done long ago. I need to send request directly to server ,without any proxy,Like Application------------ Sends Request to-------------------->ServerApplication<------------Respond back to----------------------Server and all this to be done on cross domain....This is the exact problem

Edited by Shobit
Link to comment
Share on other sites

I thought it's been mentioned that to request information cross-server, you need to use a server-side script, which essentially will act as a proxy.http://en.wikipedia.org/wiki/Proxy_server

Link to comment
Share on other sites

Forms do not have the same limitations as AJAX objects. I generally dislike iFrames, but you could duplicate the AJAX functionality you want by sending your request through a form in an invisible iFrame. (It could also be visible; that part does not matter.) Your whole page would not refresh; only the iFrame would refresh. You can then access the response that appears in the iFrame and do whatever you want with it.I would test the process with a visible iFrame just to make sure the technique works for you. (Remember that the true response will only be visible when you view source. This might make a difference if tabs and line breaks are significant.)

Link to comment
Share on other sites

Forms do not have the same limitations as AJAX objects. I generally dislike iFrames, but you could duplicate the AJAX functionality you want by sending your request through a form in an invisible iFrame. (It could also be visible; that part does not matter.) Your whole page would not refresh; only the iFrame would refresh. You can then access the response that appears in the iFrame and do whatever you want with it.I would test the process with a visible iFrame just to make sure the technique works for you. (Remember that the true response will only be visible when you view source. This might make a difference if tabs and line breaks are significant.)
You can send a request to an iframe, but you won't be able to read the content of the iframe with Javascript.The only way to receive information from another domain is through server-side scripting. And it really isn't that difficult.
Link to comment
Share on other sites

If you can control what output the server sends back, then you can use a script tag proxy:http://jaybyjayfresh.com/2007/09/17/using-...-in-javascript/Or you can use a hidden iframe or a hidden form which submits to a hidden iframe:http://developer.apple.com/internet/webcontent/iframe.htmlYou could also have a Flash movie send out requests to the remote site and send the response to Javascript but, again, the remote server needs to explicitly allow that.If you cannot control what the remote server is doing, then your one option is to use a server-side proxy. Let me say that again: if you don't have control over what type of output the remote server will send, your only option is to use a server-side proxy. That is why we keep telling you to use a server-side proxy, but you don't seem like you want to believe us.

Link to comment
Share on other sites

Maybe he's confusing a "server-side proxy" with a "proxy server" and he doesn't want to use a proxy server.
Ah. Yes, "proxy server" is not what we mean. I go through one at home to avoid my ISP's censoring software. It's slow and annoying. I wouldn't want to use one either.All we are describing is a script that runs on the server you're already using. I think Synook posted the basic code for a GET-to-POST version on another thread?
Link to comment
Share on other sites

Maybe he doesn't want to use a server-side script?Or maybe he just wants to know whether it is technically possible with such a script?

Edited by Synook
Link to comment
Share on other sites

Sir ,everything is possible.I was just trying to see the working of OpenURL , so i couldn't reply last night,,,sorry for that.WellThe thing in most easiest manner is..you have an html page on hard-disk and a page on server like www.mysite.com/admin you have no proxy .no proxy web server nothing else.you clicked the button ,and the data is posted to the www......admin page..i can't explain my problem easier than this.While researching an open source toolbar like digg ,i found a command Openurl which does the same thing mentioned above,but it opens the page in other tab,which i don't wan't ,data must be posted in background.Also the server is in my control.

Edited by Shobit
Link to comment
Share on other sites

Well, if you have control over the remote server, then you can use XHR2 and make sure the server returns the correct headers. Of course, XHR2 isn't very widely supported yet, though. Some browsers also restrict the use of AJAX altogether for local pages.Have you thought about using a portable web server?

Link to comment
Share on other sites

You are trying to write an XUL application? You could have told us that earlier :)And yes, I believe Firefox 3 and above support the XHR2 specification.

Link to comment
Share on other sites

Yes, i didn't mentioned it before because previously i was dependent on toolbar studio.Just today i coded whole of my toolbar in XUL ,so i mentioned the toolbar,But still this POSTing problem is not solved.You must have seen Delicious Bookmarklets ,I don't know ,how they do this thing.The data goes to server.

Link to comment
Share on other sites

If you're making a toolbar then you probably have a whole set of things available to you that we haven't considered, I think we all assumed that you were just trying to make a web page that you double-click on to open and it sends an ajax request to another server. Regardless, if you have control over the server then you can use the script tag proxy technique:http://jaybyjayfresh.com/2007/09/17/using-...-in-javascript/

Link to comment
Share on other sites

After getting loaded ,it sends request for only one time.Next time that button remains disabled
I don't know what you're referring to, all of the techniques we've discussed can be used as many times as you want. There's no rule that you can only use something once.
Is there any Open Source Software which captures the selected data and Post it on the given url
.. like Firefox?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...