最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Mobile Safari Blocks Javascript in URL - Safari cannot run the script because JavaScript is not allowed to be used this wa

programmeradmin4浏览0评论

I was researching how to create bookmarklets for use with mobile safari and I ran across this problem:

I'm not sure why am unable to find any questions on this topic. And my Google searches came up with nothing as well. But it appears that iOS has pletely disallowed JavaScript being entered into the address bar of mobile safari. There is a message that appears like this one:

They've even gone so far as to ensure that when you're editing a bookmark on mobile Safari, There is no way to escape Single quotes or double quotes and they have pletely disabled double-quotes from the keyboard - thus handicapping the user's ability to create a bookmark with those characters in it.

So is there any way to make a bookmarklet that actually does anything? For instance, Can I create a bookmarklet that'll allow me to link to a particular website using the selected text as a parameter into the url?

And it just me or is this something new?

I was researching how to create bookmarklets for use with mobile safari and I ran across this problem:

I'm not sure why am unable to find any questions on this topic. And my Google searches came up with nothing as well. But it appears that iOS has pletely disallowed JavaScript being entered into the address bar of mobile safari. There is a message that appears like this one:

They've even gone so far as to ensure that when you're editing a bookmark on mobile Safari, There is no way to escape Single quotes or double quotes and they have pletely disabled double-quotes from the keyboard - thus handicapping the user's ability to create a bookmark with those characters in it.

So is there any way to make a bookmarklet that actually does anything? For instance, Can I create a bookmarklet that'll allow me to link to a particular website using the selected text as a parameter into the url?

And it just me or is this something new?

Share Improve this question asked Oct 14, 2015 at 21:19 JayGeeJayGee 5771 gold badge6 silver badges17 bronze badges 3
  • have you find any solution? – mu3 Commented Nov 2, 2015 at 20:05
  • no. Looks like they prevent us from doing this. – JayGee Commented Nov 3, 2015 at 5:07
  • I found js bookmarks work like a charm – mu3 Commented Nov 3, 2015 at 12:07
Add a ment  | 

1 Answer 1

Reset to default 14

The solution to bookmarklets in mobile Safari is to just not use the address bar. Create a bookmark for some random site, and edit it afterwards. I.e.:

  1. Visit google. or some other random site
  2. Bookmark it (using the share button)
  3. Go to your bookmarks and tap edit
  4. Select your placeholder bookmark and enter your code in the address field
  5. Save the changes

That's it. A little awkward, but it works.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论