/    Sign up×
Community /Pin to ProfileBookmark

Need a tiny tweak in this code

Hey everyone

I have this code to resize my browser window:

function init()
{
window.resizeBy(955 – window.innerWidth, 537 – window.innerHeight)
}

Question is:

Can I have this code only work the first time this page is opened (this is on the index page) ? So as the user goes through all the other pages and if eventually he/she resizes the window back to whatever position he/she wants and THEN goes back to the index it doesn’t change the window size again! Is is possible? If so how?

Thanks in advance,
T

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Feb 11.2009 — Well it won't resize everyone's browser, such functionality is disabled by default (I think) in Firefox, and is easy to disable if not. So is this a design feature or is it just a desire?

To refer to the question, every time the index page is loaded, it should work, provided that the browser allows it, which as I've said, is becoming more and more unlikely.
Copy linkTweet thisAlerts:
@tcabacoauthorFeb 11.2009 — Well, this is just for presentation purposes, if when first opened it changes to that position - again for the sake of the presentation - it will just look better.

And it works in the browser that we're using, and yes it is Firefox. Now I believe you miss understood our goal. When we open the web site it will resize, it does, and that's ok. And now the user is surfing through the web-site, clicking on links and he/she decides to resize the page, make it bigger.. Well what I need is that IF the user goes back to the index/main/home page, while surfing the web site, that it doesn't resize the window again automatically..

So basically we would like to have that code work - which it does - but only ONCE, only the first time the window is opened, then it deactivates or doesn't work anymore.

Is that doable?

Again thanks for your quick reply!!
Copy linkTweet thisAlerts:
@Chris_CrewFeb 12.2009 — Ain't sure on coding involved but mostly like gonna need to set someone like a cookie when they go to the index the first time.

So that if they go back to index a check can be made to see if the cookie is present and if it is don't run code
×

Success!

Help @tcabaco 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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