Is there a way to only show a clean url when doing a get request?
i.e. someone is send to a page:
http://domain.com/?param1=1¶m2=2
And the user only sees :
http://domain.com
I tried it with a post-request but then you get these annoying pop-ups when someone refreshes the page or hits the back button.
Doing a post-redirect-get is also not possible since this increases the response time to much and the page is generated dynamically so it needs the parameters.
You could use URL rewriting when you are using Apache.
Or similar functionalities in other web servers.
There are 3 ways to pass parameters from a client to a server:
GET request; which you don't want to use
POST body (includes post-redirect-get); you don't wan to use POST
request header
The way to have a client pass arbitrary parameters in a request header is cookies.
Related
Title question asks it all, what's the process going on under there? Why do I have to use AJAX if I wanted to submit that form asynchrously?
It's due to the way HTTP was designed. Back then, JavaScript was not as ubiquitous and not as powerful as it is today.
As it is, when you POST data to a page (a path), you are issuing a request to a server. The server can then respond in a variety of manners. There is the simple "return some content", whether it be HTML, text, JSON, XML, etc. There is also the possibility for the server to return a redirect, sending you to a different location.
What AJAX does is simply to run this request in the background and hide the fact that data was submitted to the server and a response was returned from the user's perspective.
I have an HTML page and it needs to send a POST request for another HTML page that's embedding a Flex application. How can I access the request body from that request in Flex?
Even though you say that you are POSTING a request from one HTML page to another; that is not actual what happens. The POST rewuest is sent to a server. That server may then process the request somehow and spit out a new HTML page. But, you cannot POST from one HTML page to another.
Since Flex is a client side technology, you cannot use a POST Request to pass data into it. You also wouldn't be able to access the POST request from Javascript as a parallel.
So, you can have your server process the data, and prepare it to send back to your Flex app. You could do this using FlashVars. If you have a greater data set, then you could somehow save the data to the server, and load it into the Flex app using HTTPService, RemoteObject, or WebService.
you can use FlashVar and External Interface to pass data from parent page to embeded Flex app
Please take a look on Communicating with the wrapper
Hopes that Helps
In the end I used a GET request and attached the data to the URL. I know it's ugly, but couldn't find any other way...
I want to make a turn based game (Something like Checkers) with the help of Servlets and jsp pages.I created a page that has a newGame button that redircet to the gamePage(It redirect the first into a Black.jsp and the other request will be redirected to Red.jsp).
My problem is ,how could I refresh the other jsp automaticaly if one of them changed.
Note:After the change in one of the jsp it redirect the request to servlet and servlet update the changed jsp graphics.but the other jsp stay inactive.I want to make it active.
Thank You
It sounds like what you need is Comet. Here's an overview of how it works.
http://www.ibm.com/developerworks/web/library/wa-cometjava/
Basically, the "other" user's browser will send a request to a servlet to get an update, but that request won't receive receive its response until the current player makes a move. This gets around the problem posed by the fact that, with traditional HTTP, the browser always has to be the one sending the request to the server, it can't be the other way around.
There are some variations on the technique. Now that you know the name, I'm sure you'll be able to find lots of useful information about it.
There's another technology called WebSocket which can also serve this purpose, but it requires additional capability built into the browser and, as of now, probably not all of your users will be using compatible browsers.
I'm no expert on web development, and need to find a way to let the browser call a PHP routine on the server with the current document ID as parameter, eg.
http://www.acme.com/index.php?id=1
I then need to call eg. /change.php with id=1 to do something about that document.
Unless I'm mistaken, there are three ways for the client to return this information:
if passed as argument in the URL (as above), it will be available as HTTP referrer
by including it as hidden field in
by sending it as cookie
I suppose using a hidden field is the most obvious choice. Are there other ways? Which solution would you recommend? Any security issues to be aware?
Thank you.
You can also POST the data so it won't be seen in the URL with ’form method = "post" ’
All of these methods are, to a point, insecure as they can be manipulated by a savvy user/hacker. You could https your site, limiting any man in then middle attacks. Be sure to check and validate incoming data
Ajax is another option as well, and it allows you to send that information without refreshing the page.
http://www.acme.com/index.php?id=1
The above url would be more "browser friendly" if you transform it into something similar to this:
http://www.acme.com/index/page/1
I am sure you can achieve this in Apache. Or Java Servlets.
I have an embedable widget. For each impression, I would like to track the referrer (the page where the widget is embedded onto). Right now I am using ExternalInterface to use javascript to check window.location.href when its available, however, I am finding that most of the time I am unable to set the referrer.
Is there a better way to do this? Or perhaps am I not using javascript correctly to get the referrer?
Thanks!
I don't think you can directly get it in this way. There are a couple options I can think of:
Get the referrer from your web server HTTP logs. Apache for example logs referrer info by default.
Have people include some referral code in their widget request, that you can use to identify where it came from.
Make a request from your widget back to your server...I think this request will contain the HTTP Referrer field pointing at where it is embedded
Use something like [swfmill][1] to embed the referrer into the actual SWF itself when it is requested from your server...but this might have too much performance overhead.