/    Sign up×
Community /Pin to ProfileBookmark

how to get the url of prev page

i have a problem in retrieving the url of previous page. i have to get the no of script request through cross domain and i am using

[CODE]if((n=calculate(document.getElementsByTagName(‘script’)))<6 )[/CODE]

and in the calculate function i have a top.countscript and am incrementing it everytime but i cant get the countscript count from prev domain which also called this script.
Can u suggest me some other function than top and parentNode as they dont seem to work

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@rohitchawlaauthorJul 30.2007 — yes i seem to understand that but im confused as how to put my point forward

i try again



well im trying to count the script request send in cross domain scenario

as almost all the browsers have it restricted

i need a way to get the no of request for my script when i traverse through different pages which all request this script

i need to keep a count for the no of requests for the script and if gets more than 5 then the script should display that u cannot request for this script more than 5 times

it seems to work when i call the script more than 5 times from a single webpage

but it fails when i traverse through 1 page to another which all request it

like in main.html page i have <iframe src="next.html"> and in the next.html i have <script src="sample.js"> when i click from main.html to next.html the script count should increase from 1 to 2 and if i keep on traversing through diffrent pages who all request this script, the count should increase

im using this code to check the no of count
[CODE]if((n=calculate(document.getElementsByTagName('script')))<6 )
[/CODE]


if the no of counts r less than 6 then the script should do what its supposed to do otherwise it should reply as script cant be accesed more tha 5 times

the function calculate counts the no of request for that script

i use a countScript to keep the no of count and i use
[CODE]if(top.countScript==null){top.countScript=1;}else{top.countScript=top.countScript+1;}
[/CODE]


this works fine when all requests originate from a single html page but if i traverse through multiple webpages which all request this script

the top.countScript always returns as null

i need the top.countScript to keep the no of record of requests earlier made which it doesnt

can u help me with some code that can keep the no of counts for the scripts when it is a cross domain issue

thanks in advance
Copy linkTweet thisAlerts:
@rohitchawlaauthorJul 30.2007 — i know i wrote the wrong name in topic but i was really confused at that time
×

Success!

Help @rohitchawla spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...