2

I have created a html page which has a div displaying image.I have to pass the base 64 image string into this html page in the url so that I can set the image div source on loading.

The html page can be called from any application may be java/javascript or any.But along with the url the image string has to be passed to the page. Here is the sample html application which calls my html page-

<!DOCTYPE html>
<html>
<body>
<script>
imagestring ="R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7";
</script>
<button type="button" onclick="window.open('URL?image='+imagestring)">open the html page </button>

</body>
</html>

Here URL points to the html page deployed on a server.This works fine only if the imagestring value is small. But if the size is huge because of the limitation on several browsers it won't work.What alternate way I can approach?

My requirement is huge datastring passing in url.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user1071096
  • 155
  • 1
  • 3
  • 14

3 Answers3

2

You need to POST the image data.

<!DOCTYPE html>
<html>
 <body>

  <form action="URL" method="POST">
   <input type="hidden" name="image" value="R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7"/>
   <button type="submit">open the html page</button>
  </form>

 </body>
</html>
Qwerky
  • 18,217
  • 6
  • 44
  • 80
  • I never worked on http request /response.I have tried posting the image string value to the html page as above posted by Qwerky ..But not getting how I can use this imagestring value in the html page? – user1071096 Jan 07 '13 at 10:40
  • Or in other words how can I get the imagestring value in the html page which is pointed by the URL? – user1071096 Jan 07 '13 at 10:57
0

Standard URLs which use GET method by default have a limit of about 8KB in length.

If you want to send large data to the server, you must use POST method. In this case, URL remains short, and actual data will be sent to server as parameters in your submit form.

You can also POST data using ajax, like this.

mvp
  • 111,019
  • 13
  • 122
  • 148
0

You are using GET method to passing your data.
you can't pass huge data by GET method. check this out: HTTP URI GET limit

Use POST method.

Community
  • 1
  • 1
Siamak Motlagh
  • 5,028
  • 7
  • 41
  • 65