Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do You Trigger a Keyboard CTRL Command with an OnClick Event

Status
Not open for further replies.

kennygadams

Programmer
Jan 2, 2005
94
US
Hi Everyone,

Is it possible to trigger a keyboard command when using the OnClick event?

I'm trying to do a 'bookmark this page' script and get stuck when trying to bookmark a page in Safari.

When someone clicks on "Bookmark this Page" I want to trigger the Cmd-D keyboard command if the user is using the Safari Mac browser.

Thanks,
Kenny
 
I looked through the first ten results from the Google search query you suggested and got the same stuff I already looked through. What I'm getting is that for these browsers, Safari and Opera, you cant use javascript code to bookmark and you have do a pop-up that says something like "hit Cmnd+D to bookmark this site."

Kenny
 
Hi

Kenny said:
you have do a pop-up that says something like "hit Cmnd+D to bookmark this site."
Why do you have to write that in a pop-up and not in the page itself ?

I think those "bookmark this page" links are useless. If the user knows what bookmarks are, he can bookmark it without link. If the visitor does not know how to create a bookmark, he probably not know neither where to find them later. So I think a link alone is for not use.

Currently I have 530 pages bookmarked, but none was created by clicking such link.

Feherke.
 
Well I wouldn't have to do the pop-up but I would want to do something to let the Mac user know that in order to bookmark the page click Cmnd+D... if the user clicked on the "bookmark this page" link

I have about 50 bookmarks and some were added by "bookmark this page" links. I think some users will use the bookmark link and others will simply ignore it.

Kenny
 
Can this be done, Trigger a Keyboard CTRL Command with the javascript onClick Event, or should I move on?

Thanks,

kennygadams
----------------------------
"quote goes here"
 
I don't think this can be done. Imagine the security problems if a website could send keystrokes to a client! If Safari does not expose a method in it's implementation of JavaScript, then you'll just have to instruct the user on what they need to do to bookmark your page.

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top