• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

overriding javascript funtions in another frame

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an app that has two frames. Each frame is a separate web app running on the same web server. I was wondering if there's a way for some javascript code in one frame to override a function declared in the app running in the other frame.

Some more context info : I'm testing my app using Selenium which basically runs a browser bot in one frame and the real app in the other frame. Due to some issues that I've encountered only when running the app with the test runner, I need to slightly change the behaviour of a javascript function of my main app when running in test mode. I want to see if I can avoid changing the original javascript function in my web app (like adding a test that checks if a "selenium" frame exists) and instead have the selenium test runner extension code override my javascript function.

Thanks,
Sanjiv
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can check to see if a frame exists in your code

something like:
if (self.parent.frames.length != 0){
//i am framed!
}

Eric
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic