942,959 Members | Top Members by Rank

Ad:
Jul 28th, 2010
0

Auto bookmark function doesn't work with an onload event

Expand Post »
I have this function:

javascript Syntax (Toggle Plain Text)
  1. function correctBookmark() {
  2. var title = "SERCO Benefits";
  3. var url = "http://wwww.example.com";
  4. if (window.sidebar) { // firefox
  5. window.sidebar.addPanel(title, url, "");
  6. } else if (document.all) { //MSIE
  7. window.external.AddFavorite(url, title);
  8. } else {
  9. alert("Sorry, your browser doesn't support this");
  10. }
  11. }

If I use an onclick function in association with a button, it works in IE and FF.

If I use:
javascript Syntax (Toggle Plain Text)
  1. window.onload = function () { correctBookmark(); }

It works in FF but not IE.

If I use:
javascript Syntax (Toggle Plain Text)
  1. $(document).ready(function () {
  2. correctBookmark();
  3. });
It works in FF but not IE.

I want to auto bookmark for the user. Any suggestions?
Last edited by Ezzaral; Jul 28th, 2010 at 2:15 pm. Reason: Changed URL to generic example.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
webdev5 is offline Offline
6 posts
since Jun 2010
Jul 28th, 2010
1
Re: Auto bookmark function doesn't work with an onload event
Quote ...
I want to auto bookmark for the user. Any suggestions?
Yes: don't do it.
And if you do, don't expect universal approval.
I can only hope that most users know enough to keep their toolbars and bookmarks locked.
fxm
Reputation Points: 40
Solved Threads: 74
Posting Pro
fxm is offline Offline
591 posts
since Apr 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: End-user help required as client's site not loading
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Ajax stops working in IE8 after reload





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC