0

I have a site like www.mysite.com and I have there a link that looks like:

<a href="http://www.someOtherSite.com/myFeature" target="_blank">My link</a>

I want to pass plenty of parameters to the new url, I tried that with adding url parameters but it looks wrong.

My question is - how can I pass parameters without using url parameters (and this is cross domain)

Do I have to do it using window.open() and then I can use postMessage? I need it to open in new tab and not new window so I can't use postMessage as far as I know.

Alon
  • 7,618
  • 18
  • 61
  • 99
  • *“but it looks wrong”* Is that your only reason for forgoing URL parameters? – Waleed Khan Feb 14 '13 at 13:21
  • no. I am afraid it will be too long and I thought if there is a better solution. it is not 2 parameters but rather 10+ long parameters that some of them stores links – Alon Feb 14 '13 at 13:28

1 Answers1

1

There is nothing wrong with using URL parameters for this. If you are opening a different domain it is your only option. The URL can store around 2000 characters. Check here for more details: What is the maximum length of a URL in different browsers?

If you need to pass more characters then that, you will need to look at alternate options, perhaps the "someOtherDomain" can make an AJAX call to mysite.com or something like that.

If the link you are opening was on the same domain then: The only other option you have is to use a cookie or session to store the parameters.

If you save the parameters in a cookie, the cookie will get sent to the server with the request loaded in the new tab

Community
  • 1
  • 1
cowls
  • 24,013
  • 8
  • 48
  • 78