Avatar of OdieGiblet
OdieGiblet

asked on 

Overriding / intercepting javascript function calls in a web page.

So I want to be able to to either replace all occurrences of a specific javascript command. Or intercept its calling and replace it with my own.

I have a very specific need where I want to create something like a bookmarklet. And this bookmarklet will execute some javascript code which tells the current pagethat I'm on that instead of calling window.open(X) it should call window.location.href = X.

How can I override this function call, or replace all occurrences of it, or intercept the message or whatever I need to do?
JavaScriptScripting Languages

Avatar of undefined
Last Comment
OdieGiblet
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of OdieGiblet
OdieGiblet

ASKER

Beautiful. Thank you so much. I didn't expect it to be so easy!
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo