Connecting Tech Pros Worldwide Help | Site Map

Finding value after the # in a URL

Matthew White
Guest
 
Posts: n/a
#1: Mar 24 '08
Hi all,

I'm working on an AJAX site, and I'm using Dojo and Mootools (both
Javascript) to provide some interactivity. Dojo has a back button fix, but
it requires the use of of a string added onto a URL (I.e.
www.site.com/pages/ becomes www.site.com/pages/#page1). I want to harness
this function to allow you to go back to the page you were on. Since AJAX
does not reload a page, a PHP script would only be called when someone did
something to reload the page, such as hitting the back button. I have tried
a few different $_SERVER variables, but none will give me the "#page1", only
the URL up until that point. Can anyone think of a way to grab the entire
URL, with the # modifiers?

Thanks in advance,
Matt White

ELINTPimp
Guest
 
Posts: n/a
#2: Mar 24 '08

re: Finding value after the # in a URL


On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.comwrote:
Quote:
Hi all,
>
I'm working on an AJAX site, and I'm using Dojo and Mootools (both
Javascript) to provide some interactivity. Dojo has a back button fix, but
it requires the use of of a string added onto a URL (I.e.http://www.site.com/pages/becomeswww.../pages/#page1). I want to harness
this function to allow you to go back to the page you were on. Since AJAX
does not reload a page, a PHP script would only be called when someone did
something to reload the page, such as hitting the back button. I have tried
a few different $_SERVER variables, but none will give me the "#page1", only
the URL up until that point. Can anyone think of a way to grab the entire
URL, with the # modifiers?
>
Thanks in advance,
Matt White
Matt,

Interesting problem. I'm not sure if the #page1 gets stripped at
HTTP...but I am recreating the issue on my server as well....

Any way you can overload that method and change that page value to a
GET value? Then your PHP will receive the value and act accordingly.

I would love to hear what your eventual solution is, though.

Regards,

Steve
Matthew White
Guest
 
Posts: n/a
#3: Mar 24 '08

re: Finding value after the # in a URL


The problem with a GET value will reload the page- something that I don't
want to do with an AJAX site. Only a # value won't force a reload.

Matt

"ELINTPimp" <smsiebe@gmail.comwrote in message
news:2f922f39-f8a1-4bd2-9f15-22772e80f042@d62g2000hsf.googlegroups.com...
Quote:
On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.comwrote:
Quote:
>Hi all,
>>
>I'm working on an AJAX site, and I'm using Dojo and Mootools (both
>Javascript) to provide some interactivity. Dojo has a back button fix,
>but
>it requires the use of of a string added onto a URL
>(I.e.http://www.site.com/pages/becomeswww.../pages/#page1). I want to
>harness
>this function to allow you to go back to the page you were on. Since
>AJAX
>does not reload a page, a PHP script would only be called when someone
>did
>something to reload the page, such as hitting the back button. I have
>tried
>a few different $_SERVER variables, but none will give me the "#page1",
>only
>the URL up until that point. Can anyone think of a way to grab the
>entire
>URL, with the # modifiers?
>>
>Thanks in advance,
>Matt White
>
Matt,
>
Interesting problem. I'm not sure if the #page1 gets stripped at
HTTP...but I am recreating the issue on my server as well....
>
Any way you can overload that method and change that page value to a
GET value? Then your PHP will receive the value and act accordingly.
>
I would love to hear what your eventual solution is, though.
>
Regards,
>
Steve
Damodhar
Guest
 
Posts: n/a
#4: Mar 24 '08

re: Finding value after the # in a URL


hi ,

using jquery to over come the problem for the particular instance
Matthew White
Guest
 
Posts: n/a
#5: Mar 24 '08

re: Finding value after the # in a URL


I'm sure jQuery is a decent framework, but I'm already using two (but both
are superior in their own ways), and a third just seems like it would be
awkward to implement, especially since it shares some of the same namespaces
with Mootools. I'd like a way to implement this is one of the two
frameworks I'm already using, or in PHP.

Matt

"Damodhar" <damu.be@gmail.comwrote in message
news:86051e11-e7d3-4fbf-97f4-c9f75ca47000@i29g2000prf.googlegroups.com...
Quote:
hi ,
>
using jquery to over come the problem for the particular instance
Matthew White
Guest
 
Posts: n/a
#6: Mar 24 '08

re: Finding value after the # in a URL


Damodhar's comment made me think, and I whipped up a piece of JavaScript
that runs only one (when the page is loaded), and that seems to be
accurately giving me the data after the #. Thanks for looking into the
problem anyways!

Matt

"Matthew White" <mgw854@msn.comwrote in message
news:WwVFj.1751$Ew5.1390@trnddc04...
Quote:
I'm sure jQuery is a decent framework, but I'm already using two (but both
are superior in their own ways), and a third just seems like it would be
awkward to implement, especially since it shares some of the same
namespaces with Mootools. I'd like a way to implement this is one of the
two frameworks I'm already using, or in PHP.
>
Matt
>
"Damodhar" <damu.be@gmail.comwrote in message
news:86051e11-e7d3-4fbf-97f4-c9f75ca47000@i29g2000prf.googlegroups.com...
Quote:
>hi ,
>>
>using jquery to over come the problem for the particular instance
>
J.O. Aho
Guest
 
Posts: n/a
#7: Mar 25 '08

re: Finding value after the # in a URL


ELINTPimp wrote:
Quote:
On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.comwrote:
Quote:
>Hi all,
>>
>I'm working on an AJAX site, and I'm using Dojo and Mootools (both
>Javascript) to provide some interactivity. Dojo has a back button fix, but
>it requires the use of of a string added onto a URL (I.e.http://www.site.com/pages/becomeswww.../pages/#page1). I want to harness
>this function to allow you to go back to the page you were on. Since AJAX
>does not reload a page, a PHP script would only be called when someone did
>something to reload the page, such as hitting the back button. I have tried
>a few different $_SERVER variables, but none will give me the "#page1", only
>the URL up until that point. Can anyone think of a way to grab the entire
>URL, with the # modifiers?
>>
>Thanks in advance,
>Matt White
>
Matt,
>
Interesting problem. I'm not sure if the #page1 gets stripped at
HTTP...but I am recreating the issue on my server as well....
The #page1 won't be sent to the web server, it's just something that the
browser uses internally

The request (seen in the url field)
http://www.site.com/pages/becomeswww...m/pages/#page1

is sent as
www.site.com/pages/becomeswww.site.com/pages/



--

//Aho
Michael Fesser
Guest
 
Posts: n/a
#8: Mar 25 '08

re: Finding value after the # in a URL


..oO(Matthew White)
Quote:
>I'm working on an AJAX site, and I'm using Dojo and Mootools (both
>Javascript) to provide some interactivity. Dojo has a back button fix, but
>it requires the use of of a string added onto a URL (I.e.
>www.site.com/pages/ becomes www.site.com/pages/#page1). I want to harness
>this function to allow you to go back to the page you were on. Since AJAX
>does not reload a page, a PHP script would only be called when someone did
>something to reload the page, such as hitting the back button. I have tried
>a few different $_SERVER variables, but none will give me the "#page1", only
>the URL up until that point. Can anyone think of a way to grab the entire
>URL, with the # modifiers?
The fragment identifier is not part of the URI. The server will never
see it.

Micha
Closed Thread