Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,862 members, 7,810,290 topics. Date: Saturday, 27 April 2024 at 05:48 AM

Help!!! I Want To Deactivate Back Button On Browser - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Help!!! I Want To Deactivate Back Button On Browser (741 Views)

Make Your Site Stop Playing Mp3 And Mp4 On Browser Instead Of Downloading / My New SMF Site Not Showing On Browser / Help On How To Display Facebook Share Button On Smf (2) (3) (4)

(1) (Reply) (Go Down)

Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 5:51pm On Dec 18, 2013
Hello guys..well I think I just have to come out cos have been indoors doing it my way but to no avail, maybe its because am a bit proud or not just satisfied enough with what have done

Am developing a game website with php( I don't want to use javascript at all). I don't want users to be able to press the back button on their browser and I also want to set the time they can spend on each question and if its time the page they are on should redirect to the main page

Thanks in Advance
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 5:58pm On Dec 18, 2013
Wow..made FP :DWow..made FP
Re: Help!!! I Want To Deactivate Back Button On Browser by DualCore1: 6:08pm On Dec 18, 2013
PHP is serverside and cannot alter a client's browser's behaviour. You should spend more time developing a serverside method to prevent your users from cheating. Think sessions.
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 6:11pm On Dec 18, 2013
Dual Core: PHP is serverside and cannot alter a client's browser's behaviour. You should spend more time developing a serverside method to prevent your users from cheating. Think sessions.

That cheating aspect is what is giving me worry that...as for sessions...hmm using it although am a bit skeptical
Re: Help!!! I Want To Deactivate Back Button On Browser by onyengbu: 6:40pm On Dec 18, 2013
cbrass:

That cheating aspect is what is giving me worry that...as for sessions...hmm using it although am a bit skeptical
I dont know what you are trying to achieve by that but if it is something like trying to prevent multiple submit, PHP can do it comfortably for you.

By the way, what kind of game can you do with php without javascript?
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 7:00pm On Dec 18, 2013
onye_ngbu*:

I dont know what you are trying to achieve by that but if it is something like trying to prevent multiple submit, PHP can do it comfortably for you.

By the way, what kind of game can you do with php without javascript?

Lol...am just trying to be adamant on not using javascript that's why..I will soon be through with it and my firends here will be the first to play it.
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 7:03pm On Dec 18, 2013
Anyway guys have coded it heavily on the server side but at this juction I think I have to compromise to use some little javascript
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 8:07pm On Dec 18, 2013
Pls who has a solution to this: windows.open() not working on IE9
Re: Help!!! I Want To Deactivate Back Button On Browser by yawatide(f): 9:32pm On Dec 18, 2013
shouldn't it be window.open()? Check your spelling, assuming that is how you have it in the code and it isn't a mere typo on this thread
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 9:37pm On Dec 18, 2013
yawa-ti-de:
shouldn't it be window.open()? Check your spelling, assuming that is how you have it in the code and it isn't a mere typo on this thread

No its a typo error here. I wrote it correctly in the script but IE9 and google chrome are blocking it even mozila is aksing questions and I need to open a page on a new window
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 3:47am On Dec 19, 2013
cbrass:

No its a typo error here. I wrote it correctly in the script but IE9 and google chrome are blocking it even mozila is aksing questions and I need to open a page on a new window



Try this window.open(url,_blank)
Re: Help!!! I Want To Deactivate Back Button On Browser by yawatide(f): 10:46am On Dec 19, 2013
Let's see how you're calling it. Post a code snippet for us
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 2:51pm On Dec 19, 2013
yawa-ti-de:
Let's see how you're calling it. Post a code snippet for us

There is a long list of php code snipets then if the conditin is true I want a redirect to occur. I could have used <script>location.href='url'</script> but I want it to be on a new window cause I want to block every attempt of the user to use the back button. Window.open() seem to work only if a button is clicked .My browser sees it as pop screen and I don't know if the user will like it if they first receive a warning from their browser before proceeding because that's what its happening when I use window.open()
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 2:56pm On Dec 19, 2013
Iam_Godzilla:


Try this window.open(url,_blank)

The problem is firefox,google chrome,and opera will first of all ask permission from the user before the redirect occurs but IE9 doesnt even allow it.
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 4:08pm On Dec 19, 2013
Try this
$('a').on('click.open', function(e)
{ e.preventDefault(); window.open('http://
url.com') });
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 7:45pm On Dec 19, 2013
Iam_Godzilla: Try this
$('a').on('click.open', function(e)
{ e.preventDefault(); window.open('http://
url.com') });


Thanks a lot, I hope it doesn't require the user clicking anything before it works? Will try it now
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 9:00pm On Dec 19, 2013
cbrass:

Thanks a lot, I hope it doesn't require the user clicking anything before it works? Will try it now

Well just let us know if you encounter any problems smiley
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 9:17pm On Dec 19, 2013
Iam_Godzilla:

Well just let us know if you encounter any problems smiley

Not working Bro sad
Iam_Godzilla:

Well just let us know if you encounter any problems smiley

Not working Bro
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 10:26pm On Dec 19, 2013
cbrass:

Not working Bro sad

Not working Bro

Ok try any of these.
Iv tried some and it worked...

1. <p>Click the button to open a new browser window.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
window.open("http://www.url.com");
}
</script>

</body>
</html>

2.


<a href="javascript:window.open('http://
google.com');return false;"> open 2 </a>

3.

onclick=window.open("about:blank","newwin"wink

...There's something you should note.. A pop up will not show if the window.open() is triggered my a click event.
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 10:29pm On Dec 19, 2013
cbrass:

Not working Bro sad

Not working Bro
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 11:30pm On Dec 19, 2013
Iam_Godzilla:

Ok try any of these.
Iv tried some and it worked...

1. <p>Click the button to open a new browser window.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
window.open("http://www.url.com");
}
</script>

</body>
</html>

2.


<a href="javascript:window.open('http://
google.com');return false;"> open 2 </a>

3.

onclick=window.open("about:blank","newwin"wink

...There's something you should note.. A pop up will not show if the window.open() is triggered my a click event.

Yea that's the case..its not triggered by a click event, even if I use a window.open() with onclick it will not show a pop up but I have a code like this:

If($name==true)
{
Echo"<script>window.open("play.php"wink;
}
Else
{
Echo"something";
}
in firefox it asks permission from the user to allow a pop up but IE9 it doesn't even work
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 12:34am On Dec 20, 2013
cbrass:

Yea that's the case..its not triggered by a click event, even if I use a window.open() with onclick it will not show a pop up but I have a code like this:

If($name==true)
{
Echo"<script>window.open("play.php"wink;
}
Else
{
Echo"something";
}
in firefox it asks permission from the user to allow a pop up but IE9 it doesn't even work

Ok, if this is your code or not...or things to look out for because IE9 is some tough browser
1. Make sure there are no spaces in the urls.
2. Make sure there are no trailing commas
3. You also need to close the script tag
</script>
4. Then another thing to check is the browser settings, cuz they also alter the way pop ups happen.
5. Ur Echo statement..
U can't use double columns in double columns.
Echo "<script>window.open('page.php');</script>
And if none of these works... I suggest you find another way to alter your development.
As there's always a way.
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 12:47am On Dec 20, 2013
Iam_Godzilla:

Ok, if this is your code or not...or things to look out for because IE9 is some tough browser
1. Make sure there are no spaces in the urls.
2. Make sure there are no trailing commas
3. You also need to close the script tag
</script>
4. Then another thing to check is the browser settings, cuz they also alter the way pop ups happen.
5. Ur Echo statement..
U can't use double columns in double columns.
Echo "<script>window.open('page.php');</script>
And if none of these works... I suggest you find another way to alter your development.
As there's always a way.

Most of those syntax errors u see there where just because I typed it here..I didn't make the mistakes in my script..well what I wll do is force every use that wishes to play the game to eisther use firefox or google chrome and will tell them before hand to allow pop ups before they register to play
Re: Help!!! I Want To Deactivate Back Button On Browser by IamGodzilla: 7:08am On Dec 20, 2013
cbrass:

Most of those syntax errors u see there where just because I typed it here..I didn't make the mistakes in my script..well what I wll do is force every use that wishes to play the game to eisther use firefox or google chrome and will tell them before hand to allow pop ups before they register to play

Good idea, you can just use a javascript code which would alert/redirect a user when he opens the site using IE, that their browser isn't supported.
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 4:42pm On Dec 20, 2013
Iam_Godzilla:

Good idea, you can just use a javascript code which would alert/redirect a user when he opens the site using IE, that their browser isn't supported.

Thanks bro, I really appreciate your profound contribution
Re: Help!!! I Want To Deactivate Back Button On Browser by cbrass(m): 4:44pm On Dec 20, 2013
I appreciate you all for you wonderful contributions, its so nice to see how people care about you. Merry Christmas

(1) (Reply)

Wordpress SEO Plugins – A Must Have / How I Hacked Ecobank Online Banking Scam Database / Web4africa Is Now No-go-area For Nigerian Webmasters

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 36
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.