So here is the new code without the need for ID's on tha <a> tags

<!DOCTYPE html>
<html>
<head>
<title>Building Unique Links for Get To Avoid Caching</title>


<script type="text/javascript">

// Goto a new unique link
function gotoLink (thisHtmlElement,link){
thisHtmlElement.href = genURI(link);
}

// Generate Unique URI
function genURI(link){
var u = pxTS();
var t = link.search("=");
if (t < 0) {
return(link + '?pxId=' + u);
} else {
return(link + '&pxId=' + u);
}
}

// Unique timeStamp for creating Unique URI's
function pxTS() {
var now = new Date();
var ts = new Array(
now.getFullYear().toString()
,now.getMonth().toString()
,now.getDay().toString()
,now.getHours().toString()
,now.getMinutes().toString()
,now.getSeconds().toString()
,now.getMilliseconds().toString()
)
var i;
var retval = '';
for (i=0; i<ts.length; i++) {
if (ts[i].length < 2) ts[i] = '0' + ts[i];
retval += ts[i];
}
return(retval);
}

</script>

</head>

<body>

<a href="#" onclick="gotoLink(this,'http://powerext.com');">Go to this new
link to powerEXT</a>
<br />
<a href="#" onclick="gotoLink(this,'http://google.com');">Go to this new
link to Google</a>
<br />
<a href="#" onclick="gotoLink(this,'http://ibm.com');">Go to this new link
to IBM</a>


</body>
</html>


On Wed, Aug 5, 2015 at 1:09 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:

Sorry I did overengineer it a little bit ... this should be enough in
gotoLink ;-)

// Goto a new unique link function gotoLink (thisHtmlElement,link){
thisHtmlElement.href = genURI(link); }

On Wed, Aug 5, 2015 at 11:52 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:

How to avoid cache in GET?

Well cache is something that only applies to GET since POST never
will cache.

Ask yourself if you really want to disable cache in GET's since this
will also disable caching of javascript and CSS files, GIF's and JPG's?

It may be a good idea in test but not in production, however sometimes
you want to force a GET to interact with the server even in production.

As Kevin explained it is very easy to avoid GET being cashed where
you descide it shouldn't cache you just include a unique parameter
in the GET. It requires a little plain javacript:

Or of course if it is in AJAX calls change the method to POST instead
of GET.

Here is a running example ...

<!DOCTYPE html>
<html>
<head>
<title>Building Unique Links for Get To Avoid Caching</title>


<script type="text/javascript">

// Goto a new unique link
function gotoLink (thisHtmlElement,link){
var a = document.getElementById(thisHtmlElement.id);
a.href = genURI(link);
}

// Generate Unique URI
function genURI(link){
var u = pxTS();
var t = link.search("=");
if (t < 0) {
return(link + '?pxId=' + u);
} else {
return(link + '&pxId=' + u);
}
}

// Unique timeStamp for creating Unique URI's
function pxTS() {
var now = new Date();
var ts = new Array(
now.getFullYear().toString()
,now.getMonth().toString()
,now.getDay().toString()
,now.getHours().toString()
,now.getMinutes().toString()
,now.getSeconds().toString()
,now.getMilliseconds().toString()
)
var i;
var retval = '';
for (i=0; i<ts.length; i++) {
if (ts[i].length < 2) ts[i] = '0' + ts[i];
retval += ts[i];
}
return(retval);
}

</script>

</head>

<body>

<a id="link1" href="#" onclick="gotoLink(this,'http://powerext.com');">Go
to this new link</a>

</body>
</html>



On Wed, Aug 5, 2015 at 9:04 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:

Gent's

Angular is like EXT JS very advanced OO javascript and therefore they
have a steep lerning curve not only specially for old Cobol and RPG
programmers but also for .ASP and PHP programmers since OO
javascript may be quite different from traditional class based OO
languages since OO javascript also uses prototyping that may be
combined with the traditional class based OO.

If I should start again I would start with taking classes or reading a
book
in the basic concept of OO javascript. That is a huge time saver before
you start using any OO javascript based framework and btw node.js
and websockets.

Also use a network outside the IBM I community, they are all around
you and you will connect with young people to whom OO javascript
is natual. Many of these free groups can be found on
http://www.meetup.com/





On Wed, Aug 5, 2015 at 5:57 AM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

I looked into Angular and I saw nothing there that I needed, especially
for
basic SPAs. jQuery (and a few addons) is all I've needed (so far).

I'm sure if I dug deeper maybe I'd find something worth using, but I
think
it's much more work than needed.

My main thing was I did a few of the tutorials/lessons online and kept
thinking "ok.. how do I load data dynamically from my server... XML,
JSON,
or the next big thing.... static data is useless!"

I really grow tired of these examples where the data "fits" the lesson
(because it's created specifically FOR the lesson) when in reality the
data
and business rules are the wildcard in the project.

Brad
www.bvstools.com


On Tue, Aug 4, 2015 at 6:45 PM, Kelly Cookson <KCookson@xxxxxxxxxxxx>
wrote:

Kevin,

I definitely am a JavaScript newbie, which is one reason I've been
delaying jumping into Angular. I want to get more familiar with
JavaScript
first. Also, I am waiting for other developers in my shop to learn
Angular
so I can lean on them for help.

I think your assessment of Angular correlates with what I've heard
from
other people using Angular: it has some great features, some
difficult to
understand features, and is not for developers who lack a solid
understanding of web development fundamentals.

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
1.217.773.4486 ext. 12676
kcookson@xxxxxxxxxxxx


-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Kevin
Turner
Sent: Tuesday, August 04, 2015 6:40 PM
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] A Responsive Single Page App (SPA) with 3
Issues to
Consider

Angular has some nice intuitive features, and others that are
downright
bizarre. Most out of the box directives (you can write your own too)
are
bound to properties in the controller scope either directly or via
expressions. The controller is a JavaScript component of an angular
module,
and the scope is like the private data repository for the page. One
thing
is for sure, you have to have a pretty deep understanding of
JavaScript -
not just the simple syntax but how closures, objects and injection
work to
be able to understand Angular properly. Personally I don't think it
is a
Framework that a JavaScript newbie will cope with too well (not that
I am
suggesting you are one of those :) ) On the positive side, there are
plenty of examples and helpers on StackOverflow.



-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Kelly
Cookson
Sent: 04 August 2015 20:02
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] A Responsive Single Page App (SPA) with 3
Issues to
Consider

Mark,

Yeah, it looks like Angular is becoming the standard framework for
creating SPAs in our shop. I just haven't had time to learn it yet.
(It's a
BIG learning curve going from IBM i COBOL to contemporary web
development.)

I definitely agree that SPAs are not a magic bullet for every
situation. I
think an SPA might be useful for static content under some
circumstances:

1. If you have valued mobile users that have slow, limited bandwidth
connections to the Internet, then an SPA can help minimize the amount
of
information downloaded from the server. This can improve user
experience.

2. If the number of concurrent users is stressing the capacities of
your
servers, then an SPA can minimize the amount of bandwidth used, and
hence
the load on your servers.

Even under the circumstances of a static website, it can depend. If
your
website is basically a bunch of links to PDF files the users have to
download, then I don't know how much an SPA would help for static
content
in the form of PDF downloads.

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
1.217.773.4486 ext. 12676
kcookson@xxxxxxxxxxxx



-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Mark
Murphy/STAR BASE Consulting Inc.
Sent: Tuesday, August 04, 2015 1:43 PM
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] A Responsive Single Page App (SPA) with 3
Issues to
Consider

I guess this comes down to using the right tool for the job. SPA's
sound
like a good tool to build an interactive database application where a
"page" really doesn't make sense. Why would you want to drop into the
middle of a transaction, or would that even be a good thing to do?
But, for
navigating a corporate web site that is document based, it just
doesn't
seem to fit the bill. I don't see one approach ever fitting all
situations.
Maybe what you really need is an MVC framework providing navigation
with
the content being your SPA when appropriate, and static pages when
that is
appropriate.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Kelly Cookson <KCookson@xxxxxxxxxxxx> wrote: -----
To: "Web Enabling the IBM i (AS/400 and iSeries)" <
web400@xxxxxxxxxxxx>
From: Kelly Cookson <KCookson@xxxxxxxxxxxx>
Date: 08/04/2015 01:43PM
Subject: Re: [WEB400] A Responsive Single Page App (SPA) with 3
Issues to
Consider

One thing I have grown to dislike about having a single page app is
browser caching. I make changes to the files used for content within
the
single page app, but I often have to clear my browser cache for the
changes
to show up.

Add this to the fact that users cannot add particular "pages" to their
browser favorites. A favorites link always takes the user to the home
page.

I'm guessing there are methods for getting around these issues. If
this
were going to be a large website that a business had to spend money to
maintain, or a website used by tons of people where maximum
performance was
a necessity, then I would probably do more research to resolve the
above
issues. I definitely see the maintenance and performance benefits of
single
page apps.

But this is just a hobby site and unlikely to be used by many people.
I
don't mind spending time on it because, well, that's what hobbies are
for...spending time. So I'm going back to making it a traditional web
site
with multiple HMTL files.

The link http://www.socialhope.info/code/SocialHope_REBOOT.zip will
continue to have the source code for the single page app version of
the
website, for those who find this thread in a search or simply want to
download the code later.

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
1.217.773.4486 ext. 12676
kcookson@xxxxxxxxxxxx

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.


___________________________________________
This email has been scanned by iomartcloud.
http://www.iomartcloud.com/


________________________________

NOTICE: The information in this electronic mail transmission is
intended
by CoralTree Systems Ltd for the use of the named individuals or
entity to
which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail
transmission in error, please delete it from your system without
copying or
forwarding it, and notify the sender of the error by reply email or by
telephone, so that the sender's address records can be corrected.





--------------------------------------------------------------------------------


CoralTree Systems Limited
Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton
Hampshire
SO15 2EA
VAT Registration Number 834 1020 74.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.




--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>





--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>





--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.