Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

hide email address in source

Featured Replies

I have a requirement to display an email address on screen in the markup.

 

What's the most effective way to combat it being spidered?

 

• using the acsii version in the source?

 

• using an image of the email address?

 

• using javascript to spit it once the page is loaded?

 

I need a fairly simple solution so don't really want to get involved with server side solutions.

 

My thoughts

 

I've used images in the past, and they've been full proof. But IE seems to be muddy when displaying some images, which doesn't look good when the email addres shows as crisp clear anti aliased text (eg screenshot taken from firefox).

 

I'm happy to use the ascii version, but I'd be keen to hear users experiences with results.

 

If you've any javascript examples I'd be happy to impliment something simple, although I'd rather have something written in the markup.

I've used javascript in the markup for many years for my email address (and for email addresses of other people) and haven't knowingly had spam.

 

This is what I used:-

<script type="text/javascript">
<!--
// protected email script
emailE='myname'
emailE=(emailE + '@' + 'hotmail.com')
document.write('<a href="mailto:' + emailE + ' ">' + ' myname@hotmail.com' + '</a>')
//-->
</script>
<noscript>
<p><i>Email address protected by JavaScript.
Please enable JavaScript to contact me.</i></p>
</noscript> 

 

If the email address is your own, then consider a PHP web form which will hide the address from a viewer, but if the address is for someone else, then a web form would not be appropriate.

 

However, I use a web form now for my own email address and I understand that document.write is out of date javascript, but the javascript method is still on some of my old websites and works well.

  • Author

I've used javascript in the markup for many years for my email address (and for email addresses of other people) and haven't knowingly had spam.

 

This is what I used:-

<script type="text/javascript">
<!--
// protected email script
emailE='myname'
emailE=(emailE + '@' + 'hotmail.com')
document.write('<a href="mailto:' + emailE + ' ">' + ' myname@hotmail.com' + '</a>')
//-->
</script>
<noscript>
<p><i>Email address protected by JavaScript.
Please enable JavaScript to contact me.</i></p>
</noscript> 

 

If the email address is your own, then consider a PHP web form which will hide the address from a viewer, but if the address is for someone else, then a web form would not be appropriate.

 

However, I use a web form now for my own email address and I understand that document.write is out of date javascript, but the javascript method is still on some of my old websites and works well.

 

 

hey thanks for the reply. yes the address will belong to the site owner, but the requirement is for it to be displayed in the browser as well as web form.

 

i'll look into a javascript method, thanks!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.