Preventing Page Bounce With JS

Preventing Page Bounce With JS

  • 8,172 Kez Okundu
  • Html Css Js
  • 1 Yorum
  • 2020-02-03 07:08:22

In some cases, we may want to prevent the page from going back in the browser. Thus, we may have prevented the back button from functioning on mobile or desktop devices.

You can use the following javascript code when you do not want the back button to function.

        history.pushState(null, null, location.href);
        history.back();
        history.forward();
        window.onpopstate = function () { history.go(1); };
        
	function preventBack() { window.history.forward(); }
	
        setTimeout("preventBack()", 0);
        window.onunload = function () { null };
       
       	preventBack();
       
	window.onload = preventBack();
        window.onpageshow = function(evt) { if (evt.persisted) preventBack() }

 

I hope it works out for you.

Stay with love and knowledge...

ugur hmz
@ugur hmz demiş ki ;

Gördüğüm en kaliteli UI yapmışsın dostum.  Yormadan bilgiye rahat ulaşım eline sağlık.

YORUM YAPMAK İSTER MİSİN?

    Sponsor Reklamlar
    Son Yorumlar
    Etiket Bulutu
    C#PopupFormOtomatikProgramBaşlatmaBaşlangıçBasitEkran Koruyucuc#ekran görüntüsümail göndermeexedllbirleştirmekIL MergePhpMSSQL BAĞLANTIGerçekIPRealTextBinaryConvertÇalışmaSüreHesaplamakBulmakCssjQueryHtmlScroll TopYukarı ÇıkOnMinimizeControlBoxSimge DurumunaKüçültInternetGetConnectedStateİnternetBağlantıKontrolŞifre MatikPassword GeneratorHash ŞifrelemeMD5SHA1SHA256SHA384SHA512Asimetrik ŞifrelemeRSASimetrik ŞifrelemeKriptoŞifrelemeAlgoritmaDESRC2RijndaelTripleDESKeyLogKlavye DinleTuş YakalamaGlobal HookDialogResultÇıkış MesajıUyarı MesajıFormClosingMySQLConnector/NetKullanımSoruCheckBoxListViewÇoklu SilmebiosdramexploitkontrolgüvenlikinteljavascriptrowhammerscriptPHPAdmin PanelResponsiveXtbadminFreeÜcretsizWifiWirelessKeysŞifreAnahtarPasswordKablosuz AğDepolamaŞifreler NeredeKablosuz ŞifreAndroidTelefonNasılYazılırProgramlama DiliHesap MakinesiSEONedirNasıl YapılırAnalizGoogleLinkÖzgünMobilKonuResim Robots.txtSite MapŞifreli GirişŞifreli FormŞifre KoymaŞifreli AçılışCompilingDebuggingDerlemeKarma ModMixed ModeApp.ConfigKurbanBayramMübarek OlsunBlogScriptYonetimAdminPanelText EditorMSHTMLEditorYazıDüzenleyiciEasyAppKolayUygulamaÇalıştırmaAkıllı TelefonKlavyeiOSKeyboardEl YazısıCalculatorMyScriptHand WritingDosya YöneticisiFile ExplorerFTPBluetoothRootTask ManagerGörev YöneticisiSystemTargetWeb Application PentestErrorShowHideHataGösterGizlePDOSelectInsertUpdateDeleteConnectSeçimEklemeSilmeGüncellemeMsSQLVeritabanıÇeviriçiDatabaseConverterDbConvertMaskeli IPGerçek IPTarayıcı Tespitİşletim Sistemi TespitTekil Ziyaretçi BilgileriAktif Ziyaretçi BilgileriZiyaretçi SayacıVirüsTemizlemeFirewallServiceSecurityServiceTimeServicePentestGüvenliksızma TestiuniscanwindowslinuxperlDosyaKlasörListelemekFileFolderListInternetDownloadUploadSpeedMonitorServisMsconfigStartupRunServiceIOSMatematikDenklemÇözümKameraKablosuzinternetHotspotPaylaşımAyarlarKaliLinuxSharedTerminalÖsymDuyuruTimeTimeZoneDateZamanTarihdate()time()FreelancerSerbestÇalışanJobsİşlerWebSiteVersionSürümGeçişUbuntuSunucuApachephpinfo()phpversion()FonksiyonHerseyiKopyalacopyallcopySızma TestiSQLMapWindowsPython810HotSpotWi-FiWlannetshhostednetworkAutoWlanJsGeri SayımTextAreaOtomatik KayıtSayacSaniyeCountDownXtbadminV2AjaxJavaScriptNumaraFormatPhoneNumberFormatTelefonNumarasıDebuggerDetectUnpackerDisassemblerSecurityReverseEngineeringAlgorithmMacDKHOSCTFCapture The FlagForensicTriviaIntelligenceCRC32CRYPTPASSWORD_HASHWin10StoreMağazaMicrosoftReInstallWSLPowerShellPOSTCyberSiberAdli BilişimHackerUSBCDLiveToolsBruterNmapMSSQL ServerMS SQL ExpressMS AccessOracleIBM DB2SybaseInterbaseInformixExceldBase DbfVisual FoxProMySQLConnectionŞifreleri BulCMDLaZagneEthernetTuxCutNetCutNetKillPerformansCronTabCronJobRestartStopStartBashShellWireSharkFlagUSOMBTKBase64QRÇözümlerWriteUpWrite-UpFinalReconOSINTToolScannerWebsiteSiber GüvenlikPhishingVPNWannacryMobileDeviceFunctionMobil AlgılaMobil TespitisMobilephp mobilJavascriptYazı EfektKayan YazıText EffectsearchBoxinputclassplaceholdersetIntervalsetTimeoutJSpreventBackwindowpushStatehistoryonloadblock browser back buttonVPN Nediranonimtorucuz ürünucuzurunum.commarket kıyaslaürün kıyaslakıyaslakarşılaştıra101şokhappy centermigroscarrefoursabizim marketkıyasürün fiyatıfiyat kıyaslaucuz fiyatfiyat sorVideoEmbedPlayerVideoIDgetVideoIDIframeCreditCardCard DetectKart AlgılaKart TespitKredi Kartı TespitVisaMastercardAIOpenAIChatGPTYapay Zekaquickchatkrispbeatovencleanvoicepodcastleflairillustrokepatternedstockimgcopymonkeyocoyaunbouncevidyotrymaverickquickchatpuzzlelabssounddrawcleanupresumewordedlookatheresanaiforthatsynthesiadescriptotterinkforall