views:

189

answers:

3

Ok, lets say I have page.php. If i'm currently viewing page.php and I click this link:

<a href="#?call=friend.request&amp;user_id=10&amp;width=420&amp;height=250">Link</a>

The javascript box will pop up. Success!

However, if I'm on a different page, and I link to

<a href="http://domain.com/page.php#?call=friend.request&amp;amp;user_id=10&amp;amp;width=420&amp;amp;height=250"&gt;Link&lt;/a&gt;

The javascript box will not pop up when the page loads.

Any ideas?

I can't edit or find the javascript code that executes the said function, unfortunately.

+1  A: 

That's not the idea of JS, so basically what you have to do is a check in the window.onload event, so you can check the window.location to search for the # string and then parse whatever you want.

As I said, that's not the general idea of JS, so it turn out to be a little messy.

metrobalderas
+1  A: 

You would have to run a function on page load which would inspect window.location.search (which provides access to the ?call=.... part) And then calls the same javascript that the links on your page.php are calling.

James Maroney
metrobalderas is correct, I missed the "#" in your question. you would have to access it via window.location, not window.location.search. my apologies.
James Maroney
+1  A: 

My guess is that linking to the page directly like that, it sees the ? code as part of the querystring and not the hash thus making the hash value just an empty #. Can you do this without the ? in the hash value? Or you can try URL encoding it using %3F.

<a href="http://domain.com/page.php#%3Fcall=friend.request&amp;amp;user_id=10&amp;amp;width=420&amp;amp;height=250"&gt;Link&lt;/a&gt;
Shawn Steward