• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Another jscripty question

xoggoth

More fingers than teeth
Joined
Jul 8, 2005
Messages
17,144
Likes received
4,955
Thanks received
1,186
Location
xoggoth towers
Think this is probably another daft question re an impossible but again someone may know different.

My ed. s/w interactives have a random function that swaps various elements and pictures when a refresh button is clicked. On some I would prefer specific pictures when first opened so need to distinguish open from refresh but both clear any previous var values. Any way of doing it without reading or setting values in a file outside the document?

This is not online but running in webbrowser in VB.NET so IE only solutions would be ok.

Ta for any ideas.
 
To be clearer here is picture. The tiles are dragged to others and if they match they disappear to uncover a background picture. On refresh the tiles appear in different places and there is a different background but I would like to use the most attractive background for the majority who only play the game once.

Picture
 
I don't quite understand what you need but can you use cookies perhaps?
 
It's not completely clear to me either, if the refresh is reloading the page, can you just check for the http referrer (document.referrer) and if it's identical to the document.location run the code as it stands if not put the correct background image in place?
 
It's not completely clear to me either, if the refresh is reloading the page, can you just check for the http referrer (document.referrer) and if it's identical to the document.location run the code as it stands if not put the correct background image in place?

In principle that approach would work, but unfortunately the HTTP REFERER (misspelling by Tim Berners Lee when he invented the WWW :rolleyes:) header is automatically blocked by Norton Internet Security.

There's no good reason for them to do this, but they do, and it means that the REFERER header is now completely useless, given the market penetration the NIS product has.

I hate companies that break the web for the sake of making money out of peddling unjustified fear, uncertainty and doubt to the people we make the damn thing for in the first place - people who shouldn't have to know how it works :mad
 
Don't have Norton but did do a check on document.referrer and it is permanently null so maybe others do it too. Ta for all the answers.
 
In principle that approach would work, but unfortunately the HTTP REFERER (misspelling by Tim Berners Lee when he invented the WWW :rolleyes:) header is automatically blocked by Norton Internet Security.

There's no good reason for them to do this, but they do, and it means that the REFERER header is now completely useless, given the market penetration the NIS product has.

I hate companies that break the web for the sake of making money out of peddling unjustified fear, uncertainty and doubt to the people we make the damn thing for in the first place - people who shouldn't have to know how it works :mad




Now that would be just too easy :devil
 
Another solution may be to set your refresh code to do something like location=location + "?v=1" and then do a check for the querystring in the js. I think it may be available in document.location.search - alternatively just do a regex on the location string to checking for v=1 or whatever you set it to.
 

Advertisers

Back
Top