/    Sign up×
Community /Pin to ProfileBookmark

Need Javascript with IF condition for date range and then redirect to HOME page

Dear all,

I am very new to Sharepoint designer 2010. Its better to say, i am just stepping in.

I have sharepoint site which is accessible for all the users to update few information. But i want this site not to be accessible during a date range, say from 15th to 20th of every month.

I am planning to have something like this: If any user tries to access this share-point site between 15th to 20th date range of everymonth, then the browser must show an pop-up alert saying “This site is not accessible during this date range” and Redirect this sharepoint site to some other site (Say homepage http:// somesitename.xx.com) immediately.

I know very little about how to add Javascript in sharepoint webpart.

Please provide the Javascript or any best alternate solution to my concern.

Thanks in advance.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@rootFeb 02.2015 — do this as a server-side, you have more control over the site than relying on JavaScript which can be turned off on the clients browser.
Copy linkTweet thisAlerts:
@mchilapurauthorFeb 02.2015 — I have complete access to edit the server... I am trying to add this Javascript into Webparts for sharepoint and then make it to run...Please provide me the code.

Thanks.
Copy linkTweet thisAlerts:
@mchilapurauthorFeb 02.2015 — Requesting all to please give me some updates on my concern..I'm urgently in need of this Javascript...?

Please help.
Copy linkTweet thisAlerts:
@rootFeb 02.2015 — If you have access to the server, you then have access to writing a web page that does this automatically on the server before the page is sent.

Your main problem will be browsers that have JavaScript turned off, don't support JavaScript (yes they do really exist) or is a web crawler which chooses to ignore scripts to stop it crawling, etc.

Do it server-side if you have that kind of access.

What is the web page written in? PHP or ASP or other server-side and or framework?
Copy linkTweet thisAlerts:
@xelawhoFeb 03.2015 — Your main problem will be browsers that have JavaScript turned off, don't support JavaScript (yes they do really exist) or is a web crawler which chooses to ignore scripts to stop it crawling, etc.[/QUOTE]

You can add to that list the fact that anyone with the date set wrong on their computer (either by mistake or design) will see your site when they're not supposed to and won't see it when they are supposed to. Take the advice - do it server-side.
Copy linkTweet thisAlerts:
@jedaisoulFeb 04.2015 — Requesting all to please give me some updates on my concern..I'm urgently in need of this Javascript...?

Please help.[/QUOTE]

We generally give advice, or help people to fix problems in their code. If you want someone to write bespoke code for you, you will probably need to pay for it. ?
×

Success!

Help @mchilapur 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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