Home > Archive > PHP Language > March 2008 > Finding value after the # in a URL
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Finding value after the # in a URL
|
|
| Matthew White 2008-03-24, 7:04 pm |
| 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 2008-03-24, 7:04 pm |
| On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.com> wrote:
> 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/becomeswww.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
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 2008-03-24, 7:04 pm |
| 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.com> wrote in message
news:2f922f39-f8a1-4bd2-9f15-22772e80f042@d62g2000hsf.googlegroups.com...
> On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.com> wrote:
>
> 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 2008-03-24, 7:04 pm |
| hi ,
using jquery to over come the problem for the particular instance
| |
| Matthew White 2008-03-24, 7:04 pm |
| 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.com> wrote in message
news:86051e11-e7d3-4fbf-97f4-c9f75ca47000@i29g2000prf.googlegroups.com...
> hi ,
>
> using jquery to over come the problem for the particular instance
| |
| Matthew White 2008-03-24, 7:04 pm |
| 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.com> wrote in message
news:WwVFj.1751$Ew5.1390@trnddc04...
> 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.com> wrote in message
> news:86051e11-e7d3-4fbf-97f4-c9f75ca47000@i29g2000prf.googlegroups.com...
>
| |
| J.O. Aho 2008-03-25, 4:03 am |
| ELINTPimp wrote:
> On Mar 24, 4:22 pm, "Matthew White" <mgw...@msn.com> wrote:
>
> 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)
www.site.com/pages/becomeswww.site.com/pages/#page1
is sent as
www.site.com/pages/becomeswww.site.com/pages/
--
//Aho
| |
| Michael Fesser 2008-03-25, 7:08 pm |
| ..oO(Matthew White)
>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
|
|
|
|
|