URL query string AND internal page link ?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

URL query string AND internal page link ?

Post by califdon »

I want to have an anchor link with a target of the same page, but with a $_GET query string AND a reference to an internal #link. That is, I want to refresh the page (for pagination) and return it to the appropriate place on the page, which is several scrolls from the top. When I try to do this like:

Code: Select all

<a href='index.php#comments?start=10'>Next</a>
it ignores the internal link. When I try this

Code: Select all

<a href='index.php?start=10#comments'>Next</a>
it gets totally lost!

But this works just fine, except of course it contains no $_GET data:

Code: Select all

<a href='index.php#comments'>Next</a>
I haven't found anything useful by searching the web.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: URL query string AND internal page link ?

Post by twinedev »

What browser are you using? Here is an example I saw when googling this that DID work for me in FF, Chrome and IE

http://www.idc-online.com/course_schedu ... a#Edmonton
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: URL query string AND internal page link ?

Post by califdon »

Wow! That's exactly what I've been trying to do, and I thought I had tried that combination, but now I'll go back and check what I did. Thanks! I thought that should work, but either it didn't work or my eyes were glazing over, because I was using Firefox primarily, and checking it in IE8, as I always do, and your link works fine in FF.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: URL query string AND internal page link ?

Post by califdon »

:oops: Well, you know the old story: "Now it works!" I must have had some other flaw in my code, before! Thanks again.
Post Reply