JavaScript Why below code is not working? [duplicate]

If the parent page A and the iframe page B are in different domains, you will not be able to access methods or fields via B's parent property, nor will script in A be able to reach into B's content, nor will you be able to share global variables between A and B. This boundary placed between page A and page B is a key part of the browser security model. It's what prevents evil.com from wrapping your online bank web page and stealing your account info just by reading the internal variables of the javascript of the bank's web page.

If you have the luxury of requiring the latest generation of browsers, you can use the postmessage technique mentioned in one of the other answers here. If you need to support older browsers, you may be able to pass small amounts of information using cross-domain client scripting techniques in the browser. One example of this is to use iframes to communicate info between the outer page A and the inner page B. It's not easy and there are many steps involved, but it can be done. I wrote an article on this awhile ago.

You will not be able to monitor clicks in B's iframe from the parent page A. That's a violation of browser security policies at multiple levels. (Click hijacking, for one) You won't be able to see when B's URL changes - A can write to the iframe.src property to change the URL, but once the iframe.src points to a different domain than A's domain, A can no longer read the iframe.src property.

If A and B are in different subdomains of the same root domain, you may have an opportunity to "lower" the domain to a common root. For example, if the outer page A is hosted in subdomain A.foo.bar.com, and B is hosted in subdomain foo.bar.com, then you can lower the domain in page A to foo.bar.com (by assigning window.domain = "foo.bar.com" in A's script). Page A will then behave as a peer of page B and the two can then access each other's data as needed, even though A is technically being served from a different domain than B. I wrote an article on domain lowering, too.

Domain lowering can only peel off innermost subdomains to operate in the context of a root domain. You can't change A.foo.bar.com to abc.com.

There is also a slight risk in lowering domains to a common root domain. When you operate your page in its own subdomain, your html and script are segregated from the other subdomains off the common root domain. If a server in one of the other subdomains is compromised, it doesn't really affect your html page.

If you lower your page's domain to the common root domain, you are exposing your internals to script running on the common root domain and to script from other subdomains that has also lowered its domain to the common root. If a server in one of the other subdomains is compromised, it will have access to your script's internals and therefore it may have compromised your subdomain as well.

Answer:1

in case the page & frame are not on the same domain, you'll have to use postmessage as the same-domain policy prohibits normal javascript-communication between pages/frames of different domains because of security concerns.

postmessage is part of html5 and works in all modern browsers (including IE8). if you need support for older browsers (specifally IE6/7), you could use the jQuery postmessage plugin (which transparently falls back to some nice hash-tag trickery for older browsers).

and as a sidenote: not sure if frames are evil, there are some problems (usability, SEO, ...) related to them, but i did some research and most of these can be tackled i think.

Answer:2

I tried the code in here Scrolling page in RSelenium but it's not working as the web site that I'm working on will load more content as you scroll down. For example webElem <- remDr$findElement("...

I tried the code in here Scrolling page in RSelenium but it's not working as the web site that I'm working on will load more content as you scroll down. For example webElem <- remDr$findElement("...

  1. selenium scroll down python
  2. selenium scroll down java
  3. selenium scroll down to element
  4. selenium scroll down c#
  5. selenium scroll down javascript
  6. selenium scroll down to element python
  7. selenium scroll down to bottom of page
  8. selenium scroll down in dropdown
  9. selenium scroll down until end
  10. selenium scroll down not working
  11. selenium scroll down page c#
  12. selenium scroll down div python
  13. selenium scroll down pixels
  14. selenium scroll down in div
  15. selenium scroll down to bottom of page c#
  16. selenium scroll down table
  17. selenium scroll down table python
  18. selenium scroll down ruby
  19. selenium scroll down browser
  20. selenium scroll down slowly

I have a form where the user enters some numbers. These numbers are indexes. The problem is that when I'm posting the model to the server I need the index to be zero-based. But the index should be ...

I have a form where the user enters some numbers. These numbers are indexes. The problem is that when I'm posting the model to the server I need the index to be zero-based. But the index should be ...

I have a really strange problem: I am using jQuery v11 on the latest Chrome on localhost. While I manage to use jQuery.animate() on my website with any elements and features (including opacity), I ...

I have a really strange problem: I am using jQuery v11 on the latest Chrome on localhost. While I manage to use jQuery.animate() on my website with any elements and features (including opacity), I ...

  1. jquery opacity animation example
  2. jquery opacity animation
  3. jquery animation opacity 0 to 1
  4. jquery alpha animation
  5. jquery animate opacity not working
  6. jquery animate opacity toggle
  7. jquery animate opacity 0
  8. jquery animate opacity to 1
  9. jquery animate opacity display none
  10. jquery animate opacity left to right
  11. jquery animate opacity loop
  12. jquery animate opacity on scroll
  13. jquery animate opacity then hide
  14. jquery animate opacity easing
  15. jquery animate opacity slow
  16. jquery animate opacity w3schools
  17. jquery animate opacity time
  18. jquery animate opacity doesn't work
  19. jquery animate opacity display block
  20. jquery animate opacity 0 to 100

Is there an empty Subscription in RxJs? In RxJava, there is Subscriptions.empty(). An empty Subscription is a Subscription to which unsubscribe does nothing except to change isUnsubscribed to true. ...

Is there an empty Subscription in RxJs? In RxJava, there is Subscriptions.empty(). An empty Subscription is a Subscription to which unsubscribe does nothing except to change isUnsubscribed to true. ...

  1. empty subscribe rxjs