0

I have multiple iframe in the page in the form of tabs . Now as the new tab is created in the website a new iframe is added . Every window in the iframe keep sending data after 1-2 seconds as a result as the number of tabs increased the page start become hang.

I want to know is there any way that i can enable and disable those jquery requests of iframe so in this way if the tab is active i will allow the request and on rest tab i will disable the request .

I got this link but its not solving the problem

 window.parent.frame["frame1"].stop()

and i putt name =frame1 but it give me this message TypeError: window.parent.frame is undefined

   <iframe id = "iframe1" name="iframe1" class="iframe1" frameborder="0"  src="xxx" scrolling="auto"></iframe>
Community
  • 1
  • 1
Uahmed
  • 1,847
  • 5
  • 29
  • 45
  • Share your HTML because we can't view where is your frame – Marcos Pérez Gude Sep 22 '15 at 14:03
  • @MarcosPérezGude just added the iframe code , the whole code has many libraries – Uahmed Sep 22 '15 at 14:07
  • `stop()` is a function within the iframe1 page. Does this function exist on your iframe1? – Andrew Sep 22 '15 at 14:08
  • no i dont have any function inside the iframe1 page . All the iframe pages are links of different 3rd party website – Uahmed Sep 22 '15 at 14:10
  • window.parent.frame is undefined because it simply does not exist... It is window.parent.frames – Salketer Sep 22 '15 at 14:15
  • Sounds like you then want to perform an ajax call to that page that is being loaded. With an ajax call you can stop the request. However, if you are blocked from requesting the page using ajax because of Cross-Domain access then I would assume the third party didn't allow and doesn't want you consuming their content within your site. Otherwise, you will need to look into a **reverse proxy** to get that page to a domain you can perform an ajax request. – Andrew Sep 22 '15 at 14:22
  • Possible duplicate question w/Answer: http://stackoverflow.com/questions/9669086/how-to-stop-iframe-loading – Andrew Sep 22 '15 at 14:26
  • @Andrew i will check about reverse proxy , regarding your second post . I can not destroy the iframe as user also able to login through the iframe . The ideal scenerio for me to stop the ajax call somehow so it dont communicate further . – Uahmed Sep 22 '15 at 14:32
  • @user1224233 Not knowing the solution you are implementing a **reverse proxy** is only a suggestion. I would highly advise caution when programming against a source of input that doesn't have clearly defined usage or an official API. You have less control and you'll be running a greater risk of having the rug pulled out from under you when they make unannounced changes. – Andrew Sep 22 '15 at 14:42
  • @Andrew thanks for the message . So there is no any way that i can stop the further comunication by iframe ? – Uahmed Sep 22 '15 at 14:49
  • @user1224233 A little clarification, a request you initiate cannot be stopped. So if you make a call to google.com then quickly close your browser, before it loads, your request still got processed by google.com's servers. The only thing that you did was prevent your browser from processing of the response. So although you can "cancel" ajax requests you have really only just "cancelled" the processing of the response. Ultimately to answer you question, "No". If you don't want a server to process a request, don't initiate that request. – Andrew Sep 22 '15 at 15:12

0 Answers0