SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Feb 19, 2008, 16:50 #1
- Join Date
- Jan 2008
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
URL of Iframe that is generated by script
Iframe is generated on my page by a script like this...
Code:<script src="http://example.com/make_iframe"></script>
Or is this not something that can be done with javascript?
-
Feb 19, 2008, 17:01 #2
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
The script that makes the iframe would have to create a reference to the window.
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
-
Feb 19, 2008, 17:04 #3
- Join Date
- Jan 2008
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Otherwise there is no way? or just not with JavaScript?
-
Feb 19, 2008, 17:20 #4
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
If the iframe has an identifier then it can be possible to get the specific iframe, and another more brute force method is to get all iframe elements.
Code javascript:// get the iframe by an identifier iframe = document.getElementById('myIframe'); // get the iframe from an element list iframe = document.getElementByTagName('iframe')[0]; // get the src of the frame var url = iframe.getAttribute('src');
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
-
Feb 19, 2008, 17:24 #5
- Join Date
- Jan 2008
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Unfortunately the script does not print the iframe code to source code of page so that wont work. I only see the script itself in the page source.
-
Feb 19, 2008, 17:40 #6
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
That's fine because scripts don't look at the source code.
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
Bookmarks