-
-
Save colinyoung/828064 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Need to grab hash from page here | |
// Append hash to iFrame src url | |
var hash = (location.href.split("#")[1] || ""); | |
// change to your application's requirement, probably hash or id | |
var your_param = "hash_value"; | |
// Set path to the iframe file | |
var url = 'http://www.google.com/'; | |
if (hash) url += '?' + your_param + '=' + hash; | |
// Setup the iframe target | |
var iframe='<iframe id="frame" name="widget" src ="#" width="100%" height="1" marginheight="0" marginwidth="0" frameborder="no" scrolling="no"></iframe>'; | |
// Write the iframe to the page | |
document.write(iframe); | |
var myIframe = parent.document.getElementById("frame"); | |
// Setup the width and height | |
myIframe.height = 350; | |
myIframe.width = 960; | |
myIframe.src = url; | |
// set the style of the iframe | |
myIframe.style.border = "1px solid #999"; | |
myIframe.style.padding = "8px"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Awesome Test</title></head> | |
<body> | |
<!-- one line of JavaScript is all that is needed to generate the iframe. --> | |
<script language="JavaScript" src="js_code.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment