473,385 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why won't this ASP variable work in Firefox?

Hi all,

Strange thing. I want users to be able to go back to a list of products after they have looked at their shopping basket.

Whilst in their shopping basket they may make edits etc so it's not always a 1 click back method, for which I would usually use the following javascript:

<html>
<head>

<script language="JavaScript" type="text/JavaScript">

function back1ins() {
history.go(-1);
}

</script>

</head>
<body>
// then call function via link
</body>
</html>

So now instead, as there may be several clicks back to the list of products, I want to assign the value from a session variable (yes I know) initialised when they first visit their basket.

The following proved very successful in IE but won't work in Firefox.

<html>
// assign asp variable "strViewcount" + 1 from session var, each time the page is refreshed
<head>

<script language="JavaScript" type="text/JavaScript">

function back1ins() {
history.go('<%= strViewcount %>');
}

</script>

</head>
<body>
// then call function via link
</body>
</html>

If this does the job perfectly in IE, why won't it work in Firefox?
Any answers???

Mike.
Aug 28 '07 #1
4 2039
JamieHowarth0
533 Expert 512MB
Hi Mike,

Probably because Firefox doesn't like handling the ASP delimiters <% %>.
Always trust FF over IE, as FF is truly W3C-compliant.

Surely the best way is to capture the referring URL when the user opens the shopping cart? That way, you store the referring URL in session and simply redirect when the user has finished:
<%
Dim strThisFile = (Request.ServerVariables("URL") & Request.ServerVariables("SCRIPT_NAME"))
If Request.ServerVariables("HTTP_REFERRER") <> strThisFile
'Referring page different
%>
<a href="<%=strThisFile%>">Previous page results</a>
<%
End If
%>

Note that this method only works if you're using POST to handle shopping cart edits - otherwise the URLs will be different (handling querystrings = changing URLs) and won't work properly.

Hope this helps.

medicineworker
Aug 28 '07 #2
Thanks medicineworker, that was indeed a prompt response.

Yes, I agree there are other ways around it but I've used the javascript history in the past because it's so quick and easy. This is the first time I've tried combining js and asp variables (not a good idea) and I was suprised that it worked in IE in the first place.

I'm still curious however, as to whether FF has the functionality to recognise this type variable substitution (<%= %>) and if anyone knows a way in which it would in FF I would be interested. Maybe by specifying variable type somehow???

Many thanks again.

Mike.
Aug 28 '07 #3
JamieHowarth0
533 Expert 512MB
I suspect it has something to do with IE interpreting the script block - after all, ASP is traditionally a Microsoft implementation.
I would suggest that you try checking the Error Console in Firefox and seeing what comes up there whenever you load your page? That might give you an indication to the source and subsequent potential solutions to your problem.

medicineworker
Aug 28 '07 #4
iam_clint
1,208 Expert 1GB
Hi Mike,

Probably because Firefox doesn't like handling the ASP delimiters <% %>.
Always trust FF over IE, as FF is truly W3C-compliant.

Surely the best way is to capture the referring URL when the user opens the shopping cart? That way, you store the referring URL in session and simply redirect when the user has finished:
<%
Dim strThisFile = (Request.ServerVariables("URL") & Request.ServerVariables("SCRIPT_NAME"))
If Request.ServerVariables("HTTP_REFERRER") <> strThisFile
'Referring page different
%>
<a href="<%=strThisFile%>">Previous page results</a>
<%
End If
%>

Note that this method only works if you're using POST to handle shopping cart edits - otherwise the URLs will be different (handling querystrings = changing URLs) and won't work properly.

Hope this helps.

medicineworker
Probably because Firefox doesn't like handling the ASP delimiters <% %>.
Always trust FF over IE, as FF is truly W3C-compliant.



This is wrong. the server will handle <% %> before it ever sends it to the browser. the browser will never see <% %>

you should response.write the variable and make sure theres not ' in it that would cause the script to break.
Aug 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: aznFETISH | last post by:
I have had this on a page for a long time <span style="text-align:left;text-indent: 0em;line-height:12pt;font-family: futura, helvetica, arial, sans-serif;font-weight: normal;font-size:...
5
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine...
4
by: petermichaux | last post by:
Hi, I'm hoping for a reason I'm wrong or an alternate solution... I'd like to be able to dynamically include some javascript files. This is like scriptaculous.js library but their solution is...
4
by: aramsey | last post by:
I have a javascript program that works fine under Firefox and on IE when running XP, but is having a problem with IE running under Windows 2000 Pro. On my personal XP development machine I have...
1
by: steakhaus | last post by:
I just put up a new website that won't work in Firefox, but works fine in Safari. Are there any known problems? I designed it in Dreamweaver and the navigation bar has flash buttons that should...
2
by: Altman | last post by:
I have created an ascx control and I am calling registerclientscriptblock. The path to the js file is relative to the aspx page and not the ascx file. The function runs fine in IE7 but in...
7
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor ==...
2
by: neeebs | last post by:
Hi, I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python...
5
tjc0ol
by: tjc0ol | last post by:
Hi all, I made contact page which allows visitors to input their name, email address, phone number, comments and select a comment type by using <select> element in html with javascript. Among the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.