473,587 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conflict between query-part of url and visited-state of url


I have links on an index page like this:

<a href="link" onclick="DoOnCl ick('link')"> page title </a>

-where the DoOnClick("link ")
just adds a query part to the url before executing:

location.href = "link?query ";

( this is done in order to maintain certain state information
--(instead of using cookies.))

I also use something like this:

a.link { ...different... }
a.visited { ...colors... }
a.hover { ...for each of these... }

in a css file for the index pages,
in order to distinguish the already-visited page-links.
The problem is that it's not working right.

It works with JavaScript disabled,

But with JavaScript enabled, it's only the
first-clicked page link that gets marked as having
been visited. Subsequent pages don't get marked.

Apparently the full "link?query " is being put
in the browser history, - not "link".

And since "link?query " doesn't match exactly any "link"
on the page, --none of them get marked as having been visited.

( However, - the really odd thing, - is that it does work
-right -- in my local mirror of the site!
(--I'm using the latest IE browser.)

Anyway, my question is,
can anyone think of a way around this?

Perhaps by somehow using the JavaScript's "history" object
to force recording of "link" instead of, or in addition to, "link?query ",
in the user's visited-link history, --so that they'll all get marked as such
on the index pages?
Thank you.

~Greg.

Jul 23 '05 #1
5 1918
~greg wrote:
I have links on an index page like this:

<a href="link" onclick="DoOnCl ick('link')"> page title </a>

-where the DoOnClick("link ")
just adds a query part to the url before executing:

location.href = "link?query ";


You'd better add the query string to the link's href property:

<a href="[...]" onclick="return DoOnClick(this) "> page title </a>
[...]
function DoOnClick(oLink ) {
var query = "foo=bar&baz=42 "; // change this to your needs
oLink.href += "?" + query;
return true;
}

See <news:39******* ******@individu al.net> for some explanation.

Probably this solves your described problem, too; I didn't test
your code, since I assume it will work with the above changes.

ciao ,dhgm
Jul 23 '05 #2
<a href="[...]" onclick="return DoOnClick(this) "> page title </a>
[...]
function DoOnClick(oLink ) {
var query = "foo=bar&baz=42 "; // change this to your needs
oLink.href += "?" + query;
return true;
}

See <news:39******* ******@individu al.net> for some explanation.

Probably this solves your described problem, too; I didn't test
your code, since I assume it will work with the above changes.

ciao ,dhgm

- no - it doesn't solve it. --- same thing happens.
When I following on the links on the site, the get recorded
in the browser history with the query parts attached.
(But when I follow them on the local mirror, they're recorded
without the query.)
This is good though, --thanks!,
I wouldn't have learned about it otherwise,
and it it saves space,

( although i don't understand it - --especially why "return true" part
(--- i also tried "return false, -- and it doesn't work)..

Well, -- Here's one of the index pages:
http://lcngarc.twoshakesofalambstail...9.html?0000012

(- and that's good
- i got it with an example query on it --

(--- hmmm, -- Maybe that's it, -- that the query's are like that,
-- not like "?a=b" ,. .the browser might not recognize it as a query on the url?? ...)

Here's an example of a link on the index page:
3 <a name='n3' class='clA' id='id3' href='1994/09/1994090075.html ' onclick="return Nav(this)">Welc ome! `<i>Perry E.
Metzger</i>`</a>

And the relevant JavaScript follows.
~greg
---------------------------------------------
var state = '';

function Nav( addr )
{
addr.href += state;
return true;
}

function RealTop(el)
{
var y = el.offsetTop;
var el2 = el.offsetParent ;
while (el2 != null)
{
y += el2.offsetTop;
el2 = el2.offsetParen t;
}
return y;
}
function DoOnLoad()
{
state = location.search .substring(0,6) ;

var target = location.search .substring(6);

if(target != '')
{
var el = document.getEle mentById( 'id' + target);

el.style.color = "#FF0000";
el.style.backgr ound = "#FFFFFF";
el.style.textDe coration = "line-through";

var h = 200; // wild guess for the default
var h1 = document.body.c lientHeight; // NN n/a IE ok
var h2 = window.innerHei ght; // NN 4 IE n/a
if ( (h1 != null) && (h1 != 0)) h = h1;
else if ( (h2 != null) && (h2 != 0)) h = h2;

h = Math.floor(h/2);

var y = null;

if( el.offsetTop){y = RealTop(el)}
else if (el.y) {y = el.y}

if ( y != null ) { scrollBy(0, y - h)}
else{location.h ref = '#n' + target }
}

}


Jul 23 '05 #3
~greg wrote:
When I following on the links on the site, the get recorded
in the browser history with the query parts attached.
(But when I follow them on the local mirror, they're recorded
without the query.)


Does "on the local mirror" mean "using the file: protocol"?
Then it's completely usual that some browsers totally ignore
the searchpart.

ciao, dhgm
Jul 23 '05 #4


Does "on the local mirror" mean "using the file: protocol"?
yes

Then it's completely usual that some browsers totally ignore
the searchpart.

well (IE6) doesn't ignore completely
- it in the sense that the search part
does show in the address bar,
--and it's acted on by the javascript,

It's just in the history folder that the search part
of urls isn't included when using file:// protocol,
so that right links get marked as visited
---using file:// protocol,

--but not when using html:// protocol.

yep, -- that's the problem ...
:)
~greg.



Jul 23 '05 #5
"Dietmar Meier" > ....


i guess the only solution is
to not keep state in the query part.

--gotta use cookies...

--drats..


Arrivederci, :)

~greg.


Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
94535
by: Max | last post by:
Hi, I have SqlServer 2000 as back end and Access 2000 as front-end. All tables from Sqlserver are linked to Access 2000. I am having write conflict problem with one of my form which is bound to a query which consist of let say tableA , TableB and TableC (all are linked tables from SqlServer. While the form is open I am modifying TableA...
1
1561
by: Johm | last post by:
In my query, consisting of 2 tables, customers and orders,i get the employeeid number ordered with a given customer. The query is the following : SELECT orders.orderid, Customers.Customerid, Customers.EmployeeID FROM orders INNER JOIN Customers ON orders.customerid = Customers.Customerid; If i add on another table in the query, the...
1
1603
by: Eric E | last post by:
Hi all, I am using an Access 2000 client linked to a Postgresql 7.4 server via ODBC. I have a stored proc on the server that inserts rows into a table.particular table, accomplished via an INSERT within the body of the stored proc. The problem is that Access will not modify these records via table or form view (form has a DAO...
1
3068
by: shumaker | last post by:
I've loked over older messages on this, but haven't found a solution. I have a datasheet of records, and each record has a subform that can be viewed with the expand '+' symbol. The subform simply shows addition fields of the record it is expanded from. I used the subform control wizard to tell it how to link the records when creating the...
4
8492
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q, based on the same table. The code: Private Sub Select_BeforeUpdate(Cancel As Integer) On Error GoTo resetselect_Err
1
2444
by: lorirobn | last post by:
Hi, I have a query that I have been using as a record source for a form with no problems. I just created a new "addnew" form, and added 20 records to the table with this form. The problem I now have is I cannot modify data on these new records using my query. The query's sql is: SELECT tblSpaceUse.* FROM tblSpaceUse; The error I get...
3
1878
by: Bidhan | last post by:
Hi, I have a table (Stock) important field are partsNo., des, qty, pPrice, sPrice, qtyBuy. I make a query based on the table and has one more field SAB(qty+qtyBuy). I made a form based on the query. User can enter data in any field. When I enter data in ‘qtyBuy’ field I can see the added value by SAB field. My obligation is to set this value...
14
3525
lotus18
by: lotus18 | last post by:
Hello World I have a problem in detecting the conflict schedule (Day and Time). Day 1. M 2. T 3. W 4. TH 5. F
14
6883
lotus18
by: lotus18 | last post by:
Hello all I have these records on my Day Table for my complete database table please click here 1. M 2. T 3. W 4. TH 5. F 6. S
2
6115
Uncle Dickie
by: Uncle Dickie | last post by:
Hi All, I am getting the error: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation. when I run a query I have written. The SQL I have written is pretty long (I can post it if needed but don't want to confuse things too much!), but basically it goes something...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.