Avatar of adworldmedia
adworldmediaFlag for United States of America asked on

Need to bust cache when including a Javascript file

I've programmed a bit of code, that injects some Javascript onto a page, and i've noticed in IE only (FF doesn't do this) it caches the info, and if the same code is placed multiple times on the page, it displays the exact same info.

Here is what the javascript looks like:

<script language="javascript" src="http://{url}/roturl.aspx?js=1&pid=4&loc=~/banners/1/1/300x250&data=gNcdv%2fmwhskVxLi%2bQNJhAfgJYFlJTJ%2f9Tq73nMQwXjD5hfENhjycy20jEkk2AD5ou6Te83wPL3eafsrZgaxOwKLtcAMqF7mRk6ei86MKBKJfDIzZXbnSKg%3d%3d"></script>

I would like to use javascript to generate a random number, and then append it to the Querystring in the src= field.

How would I do that?
JavaScript

Avatar of undefined
Last Comment
GaryRasmussen

8/22/2022 - Mon
GaryRasmussen

Found this on Google

var randomnumber=Math.floor(Math.random()*11)

where 11 dictates that the random number will fall between 0-10. To increase the range to, say, 100, simply change 11 to 101 instead.

ASKER
adworldmedia

I'm sorry, perhaps I didn't make my question clear enough.

I know how to get the random number, but how do I put it in the HTML tags added to the page to make it work?

IE: How do I modify the codes:

<script language="javascript" src="http://{url}/roturl.aspx?js=1&pid=4&loc=~/banners/1/1/300x250&data=gNcdv%2fmwhskVxLi%2bQNJhAfgJYFlJTJ%2f9Tq73nMQwXjD5hfENhjycy20jEkk2AD5ou6Te83wPL3eafsrZgaxOwKLtcAMqF7mRk6ei86MKBKJfDIzZXbnSKg%3d%3d"></script>

To add that random variable to the end of the src= URL?
GaryRasmussen

"I've programmed a bit of code, that injects some Javascript onto a page"

What language are you using to inject the javascript?  ASP, Javescript?

Couldn't you just append it when you build the querystring?

I'd love to help.  Please explain.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
adworldmedia

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
GaryRasmussen

That is a good idea,
"Couldn't you just append it when you build the querystring?"

Glad you thought of it.