0

I've got a simple chrome extension that is linked with an iframe. The src points to a domain with various sub pages. When a user clicks off the iframe and the panel disappears. The src is forgotten and once reactivated it reloads the original src instead of the page the user last left off. Is it possible to save the iframes src and update for the user via javascript?

manifest.json

{
"name": "Test",
"version": "1",
"manifest_version": 2,
"browser_action":{
"default_icon":"icon.png",
"default_popup":"popup.html",
"default_title": "Test"
}
}

popup.html

<html lang="en" dir="ltr">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<body style="padding:0; margin:0;"><iframe style="padding:0; margin:0;" width="315"height="306" src="http://www.example.com"></iframe>
</body>
</html>
sparkones
  • 39
  • 1
  • 2
  • 9
  • you could try `localStorage` to store the src. – gp. Oct 14 '13 at 03:18
  • YDid that actually work for you? I tried it from the source : http://stackoverflow.com/a/3714005/2762516 but didn'twork. Only returns already set url property, but not newly navigated url from the users actions? – Casey ScriptFu Pharr Oct 14 '13 at 03:33
  • I'm looking into the localStorage right now. – sparkones Oct 14 '13 at 03:37
  • The local storage wont be an issue. It saves anything you cram in it. I just couldn't get this line of code, to actually return what the current url state of the iframe was, not the initial property of it set during run time. So curious myself. That way I can also use the method. :) – Casey ScriptFu Pharr Oct 14 '13 at 03:38
  • Yeah it would be great, i've tried various solutions but no luck yet. :D – sparkones Oct 14 '13 at 03:39
  • Will the user be navigating within your domain, or outside of it? If outside, from what I know, you cannot track it. You can find a refernce here: http://stackoverflow.com/questions/1903661/how-to-track-the-user-in-an-iframe Good luck! – Casey ScriptFu Pharr Oct 14 '13 at 03:41
  • Nope the user will stay on my domain. Thanks for the help! – sparkones Oct 14 '13 at 03:55
  • I've been using var currentFrame = document.getElementById("kml_frame").src; to fetch the current url but it returns the original src and not the actual content url. is there another way? – sparkones Oct 16 '13 at 03:29

0 Answers0